jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 20 | public class Main { |
| 21 | /* |
| 22 | * Start up. |
| 23 | */ |
| 24 | public static void main(String[] args) { |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 25 | Main main = new Main(); |
| 26 | main.run(); |
| 27 | |
| 28 | /* run through the heap to see if we trashed something */ |
Mathieu Chartier | 7befd0e | 2014-02-03 17:48:41 -0800 | [diff] [blame] | 29 | Runtime.getRuntime().gc(); |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 30 | |
| 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 Hughes | 748382f | 2012-01-26 18:07:38 -0800 | [diff] [blame] | 67 | } 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(); |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 71 | } |
| 72 | InternedString.run(); |
Jean Christophe Beyler | 3f51e7d | 2014-09-04 08:34:28 -0700 | [diff] [blame] | 73 | GenSelect.run(); |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 74 | } |
jeffhao | 795d78f | 2011-09-30 18:34:35 -0700 | [diff] [blame] | 75 | |
| 76 | public static void assertTrue(boolean condition) { |
| 77 | if (!condition) { |
| 78 | throw new Error(); |
| 79 | } |
| 80 | } |
jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame] | 81 | } |