blob: a30ec15c6693eff3ec0b77a4a76cad1f8a0c341b [file] [log] [blame]
jeffhao5d1ac922011-09-29 17:41:15 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * Dalvik instruction exerciser.
19 */
20public class Main {
21 /*
22 * Start up.
23 */
24 public static void main(String[] args) {
jeffhao5d1ac922011-09-29 17:41:15 -070025 Main main = new Main();
26 main.run();
27
28 /* run through the heap to see if we trashed something */
Mathieu Chartier7befd0e2014-02-03 17:48:41 -080029 Runtime.getRuntime().gc();
jeffhao5d1ac922011-09-29 17:41:15 -070030
31 System.out.println("Done!");
32 }
33
34 public void run() {
35 InstField instField = new InstField();
36 instField.run();
37
38 StaticField.run();
39
40 IntMath.run();
41 FloatMath.run();
42 Compare.run();
43
44 Monitor.run();
45 Switch.run();
46 Array.run();
47 Classes.run();
48 Goto.run();
49 MethodCall.run();
50 Throw.run();
51
52 try {
53 UnresTest1.run();
54 } catch (VerifyError ve) {
55 System.out.println("Caught: " + ve);
56 }
57 try {
58 UnresTest1.run();
59 } catch (VerifyError ve) {
60 System.out.println("Caught (retry): " + ve);
61 }
62
63 try {
64 UnresTest2.run();
65 } catch (VerifyError ve) {
66 System.out.println("Caught: " + ve);
Elliott Hughes748382f2012-01-26 18:07:38 -080067 } catch (Throwable th) {
68 // We and the RI throw ClassNotFoundException, but that isn't declared so javac
69 // won't let us try to catch it.
70 th.printStackTrace();
jeffhao5d1ac922011-09-29 17:41:15 -070071 }
72 InternedString.run();
Jean Christophe Beyler3f51e7d2014-09-04 08:34:28 -070073 GenSelect.run();
jeffhao5d1ac922011-09-29 17:41:15 -070074 }
jeffhao795d78f2011-09-30 18:34:35 -070075
76 public static void assertTrue(boolean condition) {
77 if (!condition) {
78 throw new Error();
79 }
80 }
jeffhao5d1ac922011-09-29 17:41:15 -070081}