blob: 7799e8cb98eaa58c2c7dd820fd5e17e5454fce44 [file] [log] [blame]
Dave Allison91a83662014-08-28 16:12:40 -07001/*
2 * Copyright (C) 2014 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
17public class Main {
18 private static native void initSignalTest2();
19 private static native void testSignal2();
20
21 private static void stackOverflow() {
22 stackOverflow();
23 }
24
25 public static void main(String[] args) {
26 System.loadLibrary("arttest");
27
28 System.out.println("init signal test");
29 initSignalTest2();
30 try {
31 Object o = null;
32 int hash = o.hashCode();
33
34 // Should never get here.
35 System.out.println("hash: " + hash);
36 throw new AssertionError();
37 } catch (NullPointerException e) {
38 System.out.println("Caught NullPointerException");
39 }
40 try {
41 stackOverflow();
42
43 // Should never get here.
44 throw new AssertionError();
45 } catch (StackOverflowError e) {
46 System.out.println("Caught StackOverflowError");
47 }
48
49 // Test that a signal in native code works.
50 testSignal2();
51 }
52}