author | ctornqvi |
Fri, 19 Aug 2016 10:06:30 -0400 | |
changeset 40631 | ed82623d7831 |
parent 38641 | 072e95e53661 |
permissions | -rw-r--r-- |
38197
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
1 |
/* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
4 |
* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
8 |
* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
13 |
* accompanied this code). |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
14 |
* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
18 |
* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
21 |
* questions. |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
22 |
*/ |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
23 |
|
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
24 |
/* |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
25 |
* @test |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38641
diff
changeset
|
26 |
* @library /test/lib |
38641
072e95e53661
8156777: [TESTBUG] test/testlibrary_tests/SimpleClassFileLoadHookTest.java requires non minimal VM
lmesnik
parents:
38197
diff
changeset
|
27 |
* @requires vm.flavor != "minimal" |
38197
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
28 |
* @run main/othervm/native -agentlib:SimpleClassFileLoadHook=Foo,XXX,YYY |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
29 |
* SimpleClassFileLoadHookTest |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
30 |
*/ |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
31 |
import jdk.test.lib.Asserts; |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
32 |
|
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
33 |
class Foo { |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
34 |
static String getValue() { |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
35 |
return "XXX"; |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
36 |
} |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
37 |
static String getOtherValue() { |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
38 |
return "xXXXxx"; |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
39 |
} |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
40 |
} |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
41 |
public class SimpleClassFileLoadHookTest { |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
42 |
public static void main(String args[]) { |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
43 |
System.out.println(Foo.getValue()); |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
44 |
System.out.println(Foo.getOtherValue()); |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
45 |
Asserts.assertTrue("YYY".equals(Foo.getValue()) && |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
46 |
"xYYYxx".equals(Foo.getOtherValue()), |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
47 |
"SimpleClassFileLoadHook should replace XXX with YYY"); |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
48 |
} |
d51ca2fac8d6
8155239: [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook
iklam
parents:
diff
changeset
|
49 |
} |