1 /*
2 * Copyright (c) 2014, 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
24 import com.oracle.java.testlibrary.Asserts;
25 import com.oracle.java.testlibrary.JDKToolFinder;
26 import com.oracle.java.testlibrary.OutputAnalyzer;
27 import com.oracle.java.testlibrary.Utils;
28 import com.oracle.java.testlibrary.dtrace.DtraceResultsAnalyzer;
29 import com.oracle.java.testlibrary.dtrace.DtraceRunner;
30 import java.io.IOException;
31 import java.lang.reflect.Executable;
32 import java.nio.file.Files;
33 import java.nio.file.Paths;
34 import java.util.Arrays;
35 import java.util.Collections;
36 import java.util.HashMap;
37 import java.util.HashSet;
38 import java.util.List;
39 import java.util.Map;
40 import java.util.Random;
41 import java.util.Set;
42 import java.util.regex.Matcher;
43 import java.util.regex.Pattern;
44 import java.util.stream.Collectors;
45
46 /*
47 * @test SegmentedCodeCacheDtraceTest
48 * @bug 8015774
49 * @requires os.family=="solaris"
98 return null;
99 }
100 Random r = Utils.getRandomInstance();
101 while (combinations.size() < maxCombinationsCount) {
102 int levels[] = new int[WORKER_METHODS_COUNT];
103 boolean inlines[] = new boolean[WORKER_METHODS_COUNT];
104 for (int i = 0; i < WORKER_METHODS_COUNT; i++) {
105 levels[i] = availableLevels[r.nextInt(len)];
106 inlines[i] = r.nextBoolean();
107 }
108 TestCombination tc = new TestCombination(levels, inlines);
109 if (combinations.add(tc)) {
110 return tc;
111 }
112 }
113 return null;
114 }
115
116 public static void main(String args[]) {
117 int iterations
118 = Integer.getInteger("com.oracle.java.testlibrary.iterations", 1);
119 if (!DtraceRunner.dtraceAvailable()) {
120 System.out.println("INFO: There is no dtrace avaiable. Skipping.");
121 return;
122 }
123 int[] availableLevels = CompilerUtils.getAvailableCompilationLevels();
124 // adding one more entry(zero) for interpeter
125 availableLevels
126 = Arrays.copyOf(availableLevels, availableLevels.length + 1);
127 Set<TestCombination> combinations = new HashSet<>();
128 for (int i = 0; i < iterations; i++) {
129 TestCombination tc
130 = generateUniqueCombination(availableLevels, combinations);
131 if (tc == null) {
132 System.out.println("INFO: no more combinations available");
133 return;
134 } else {
135 System.out.println("INFO: Running testcase for: " + tc);
136 new SegmentedCodeCacheDtraceTest().runTest(tc);
137 }
138 }
|
1 /*
2 * Copyright (c) 2014, 2015, 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
24 import jdk.test.lib.Asserts;
25 import jdk.test.lib.JDKToolFinder;
26 import jdk.test.lib.OutputAnalyzer;
27 import jdk.test.lib.Utils;
28 import jdk.test.lib.dtrace.DtraceResultsAnalyzer;
29 import jdk.test.lib.dtrace.DtraceRunner;
30 import java.io.IOException;
31 import java.lang.reflect.Executable;
32 import java.nio.file.Files;
33 import java.nio.file.Paths;
34 import java.util.Arrays;
35 import java.util.Collections;
36 import java.util.HashMap;
37 import java.util.HashSet;
38 import java.util.List;
39 import java.util.Map;
40 import java.util.Random;
41 import java.util.Set;
42 import java.util.regex.Matcher;
43 import java.util.regex.Pattern;
44 import java.util.stream.Collectors;
45
46 /*
47 * @test SegmentedCodeCacheDtraceTest
48 * @bug 8015774
49 * @requires os.family=="solaris"
98 return null;
99 }
100 Random r = Utils.getRandomInstance();
101 while (combinations.size() < maxCombinationsCount) {
102 int levels[] = new int[WORKER_METHODS_COUNT];
103 boolean inlines[] = new boolean[WORKER_METHODS_COUNT];
104 for (int i = 0; i < WORKER_METHODS_COUNT; i++) {
105 levels[i] = availableLevels[r.nextInt(len)];
106 inlines[i] = r.nextBoolean();
107 }
108 TestCombination tc = new TestCombination(levels, inlines);
109 if (combinations.add(tc)) {
110 return tc;
111 }
112 }
113 return null;
114 }
115
116 public static void main(String args[]) {
117 int iterations
118 = Integer.getInteger("jdk.test.lib.iterations", 1);
119 if (!DtraceRunner.dtraceAvailable()) {
120 System.out.println("INFO: There is no dtrace avaiable. Skipping.");
121 return;
122 }
123 int[] availableLevels = CompilerUtils.getAvailableCompilationLevels();
124 // adding one more entry(zero) for interpeter
125 availableLevels
126 = Arrays.copyOf(availableLevels, availableLevels.length + 1);
127 Set<TestCombination> combinations = new HashSet<>();
128 for (int i = 0; i < iterations; i++) {
129 TestCombination tc
130 = generateUniqueCombination(availableLevels, combinations);
131 if (tc == null) {
132 System.out.println("INFO: no more combinations available");
133 return;
134 } else {
135 System.out.println("INFO: Running testcase for: " + tc);
136 new SegmentedCodeCacheDtraceTest().runTest(tc);
137 }
138 }
|