Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ClassExclusionFilterTest.java
42283 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
package nsk.share.jdi;
24
25
import nsk.share.Consts;
26
import nsk.share.TestBug;
27
28
import java.io.PrintStream;
29
import java.util.ArrayList;
30
31
/*
32
* Class for testing class exclusion filter, this filter is added by
33
* request's method addClassExclusionFilter(String classPattern) Expected
34
* command line parameter:
35
* - class patterns which should be passed to adding filter method (e.g. -classPatterns java.*:*.Foo)
36
*/
37
public class ClassExclusionFilterTest extends EventFilterTest {
38
protected String[] classPatterns;
39
40
public static void main(String[] argv) {
41
System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
42
}
43
44
public static int run(String[] argv, PrintStream out) {
45
return new ClassExclusionFilterTest().runIt(argv, out);
46
}
47
48
protected String[] doInit(String[] args, PrintStream out) {
49
args = super.doInit(args, out);
50
51
ArrayList<String> standardArgs = new ArrayList<>();
52
53
for (int i = 0; i < args.length; i++) {
54
if (args[i].equals("-classPatterns") && (i < args.length - 1)) {
55
classPatterns = args[i + 1].split(":");
56
i++;
57
} else {
58
standardArgs.add(args[i]);
59
}
60
}
61
62
if (classPatterns == null || classPatterns.length == 0) {
63
throw new TestBug("Test requires at least one class name pattern");
64
}
65
66
return standardArgs.toArray(new String[]{});
67
}
68
69
protected int getTestFiltersNumber() {
70
return classPatterns.length;
71
}
72
73
protected EventFilters.DebugEventFilter[] createTestFilters(int testedFilterIndex) {
74
if (testedFilterIndex < 0 || testedFilterIndex >= classPatterns.length) {
75
throw new TestBug("Invalid testedFilterIndex: " + testedFilterIndex);
76
}
77
78
return new EventFilters.DebugEventFilter[]{new EventFilters.ClassExclusionFilter(classPatterns[testedFilterIndex])};
79
}
80
}
81
82