diff options
author | Dan Pasanen <invisiblek@cyanogenmod.org> | 2016-12-06 19:30:12 -0600 |
---|---|---|
committer | Dan Pasanen <invisiblek@cyanogenmod.org> | 2016-12-06 19:32:30 -0600 |
commit | 58d4793f8bd82b9daab5bf4fa40d5b68204e71eb (patch) | |
tree | 449265cbacbf925f37ed0bd201e68f080e2537cc /test | |
parent | 20af13267def46b2e5f9a6fa6e94ac69056ef16f (diff) | |
parent | 12eb0c532e33ca5d5e98addd580b5ad0a4b71be4 (diff) | |
download | android_art-cm-14.1_prerebase.tar.gz android_art-cm-14.1_prerebase.tar.bz2 android_art-cm-14.1_prerebase.zip |
Merge tag 'android-7.1.1_r4' into cm-14.1cm-14.1_prerebase
Android 7.1.1 release 4
Change-Id: I14b36666b5a478024f3a9ffab90fd675a6157461
Diffstat (limited to 'test')
-rw-r--r-- | test/596-app-images/app_images.cc | 69 | ||||
-rw-r--r-- | test/596-app-images/expected.txt | 1 | ||||
-rw-r--r-- | test/596-app-images/info.txt | 1 | ||||
-rw-r--r-- | test/596-app-images/src/Main.java | 33 | ||||
-rw-r--r-- | test/960-default-smali/expected.txt | 31 | ||||
-rw-r--r-- | test/960-default-smali/src/Foo2.java | 25 | ||||
-rw-r--r-- | test/960-default-smali/src/Foo3.java | 22 | ||||
-rw-r--r-- | test/960-default-smali/src/N.java | 21 | ||||
-rw-r--r-- | test/960-default-smali/src/O.java | 21 | ||||
-rw-r--r-- | test/960-default-smali/src/P.java | 25 | ||||
-rw-r--r-- | test/960-default-smali/src/Q.java | 21 | ||||
-rw-r--r-- | test/960-default-smali/src/classes.xml | 49 | ||||
-rw-r--r-- | test/960-default-smali/src2/Foo.java | 20 | ||||
-rw-r--r-- | test/960-default-smali/src2/Foo3.java | 25 | ||||
-rw-r--r-- | test/Android.libarttest.mk | 1 | ||||
-rw-r--r-- | test/Android.run-test.mk | 7 | ||||
-rw-r--r-- | test/ImageLayoutA/ImageLayoutA.java | 21 | ||||
-rw-r--r-- | test/ImageLayoutB/ImageLayoutB.java | 25 | ||||
-rw-r--r-- | test/Packages/Package1.java | 20 | ||||
-rw-r--r-- | test/Packages/Package2.java | 20 | ||||
-rwxr-xr-x | test/utils/python/generate_java_main.py | 6 |
21 files changed, 463 insertions, 1 deletions
diff --git a/test/596-app-images/app_images.cc b/test/596-app-images/app_images.cc new file mode 100644 index 0000000000..11c0f424ba --- /dev/null +++ b/test/596-app-images/app_images.cc @@ -0,0 +1,69 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <assert.h> +#include <iostream> +#include <pthread.h> +#include <stdio.h> +#include <vector> + +#include "gc/heap.h" +#include "gc/space/image_space.h" +#include "gc/space/space-inl.h" +#include "image.h" +#include "jni.h" +#include "mirror/class.h" +#include "runtime.h" +#include "scoped_thread_state_change.h" + +namespace art { + +namespace { + +extern "C" JNIEXPORT jboolean JNICALL Java_Main_checkAppImageLoaded(JNIEnv*, jclass) { + ScopedObjectAccess soa(Thread::Current()); + for (auto* space : Runtime::Current()->GetHeap()->GetContinuousSpaces()) { + if (space->IsImageSpace()) { + auto* image_space = space->AsImageSpace(); + const auto& image_header = image_space->GetImageHeader(); + if (image_header.IsAppImage()) { + return JNI_TRUE; + } + } + } + return JNI_FALSE; +} + +extern "C" JNIEXPORT jboolean JNICALL Java_Main_checkAppImageContains(JNIEnv*, jclass, jclass c) { + ScopedObjectAccess soa(Thread::Current()); + mirror::Class* klass_ptr = soa.Decode<mirror::Class*>(c); + for (auto* space : Runtime::Current()->GetHeap()->GetContinuousSpaces()) { + if (space->IsImageSpace()) { + auto* image_space = space->AsImageSpace(); + const auto& image_header = image_space->GetImageHeader(); + if (image_header.IsAppImage()) { + if (image_space->HasAddress(klass_ptr)) { + return JNI_TRUE; + } + } + } + } + return JNI_FALSE; +} + +} // namespace + +} // namespace art diff --git a/test/596-app-images/expected.txt b/test/596-app-images/expected.txt new file mode 100644 index 0000000000..6a5618ebc6 --- /dev/null +++ b/test/596-app-images/expected.txt @@ -0,0 +1 @@ +JNI_OnLoad called diff --git a/test/596-app-images/info.txt b/test/596-app-images/info.txt new file mode 100644 index 0000000000..a3d5e7ea70 --- /dev/null +++ b/test/596-app-images/info.txt @@ -0,0 +1 @@ +Tests that app-images are loaded and used. diff --git a/test/596-app-images/src/Main.java b/test/596-app-images/src/Main.java new file mode 100644 index 0000000000..75b31b8061 --- /dev/null +++ b/test/596-app-images/src/Main.java @@ -0,0 +1,33 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class Main { + static class Inner { + public static int abc = 0; + } + + public static void main(String[] args) { + System.loadLibrary(args[0]); + if (!checkAppImageLoaded()) { + System.out.println("App image is not loaded!"); + } else if (!checkAppImageContains(Inner.class)) { + System.out.println("App image does not contain Inner!"); + } + } + + public static native boolean checkAppImageLoaded(); + public static native boolean checkAppImageContains(Class<?> klass); +} diff --git a/test/960-default-smali/expected.txt b/test/960-default-smali/expected.txt index f3db93f87f..8153d7d4eb 100644 --- a/test/960-default-smali/expected.txt +++ b/test/960-default-smali/expected.txt @@ -98,3 +98,34 @@ M-virtual K.bar()='BAZ!' M-virtual L.bar()='BAZ!' M-virtual M.bar()='BAZ!' End testing for type M +Testing for type N +N-interface Foo.bar()='foobar' +N-virtual N.bar()='foobar' +End testing for type N +Testing for type O +O-interface Foo.bar()='foobar foobar' +O-interface Foo2.bar()='foobar foobar' +O-virtual N.bar()='foobar foobar' +O-virtual O.bar()='foobar foobar' +End testing for type O +Testing for type P +P-interface Foo.bar()='not foobar!' +P-interface Foo2.bar()='not foobar!' +P-virtual N.bar()='not foobar!' +P-virtual O.bar()='not foobar!' +P-virtual P.bar()='not foobar!' +End testing for type P +Testing for type Q +Q-interface on Foo: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +Q-interface on Foo2: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +Q-interface on Foo3: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +Q-virtual on N: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +Q-virtual on O: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +Q-virtual on Q: bar() threw exception! +Exception is of type java.lang.IncompatibleClassChangeError +End testing for type Q diff --git a/test/960-default-smali/src/Foo2.java b/test/960-default-smali/src/Foo2.java new file mode 100644 index 0000000000..2a1bbc0bea --- /dev/null +++ b/test/960-default-smali/src/Foo2.java @@ -0,0 +1,25 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +interface Foo2 extends Foo { + @Override + public default String bar() { + return "foobar foobar"; + } +} diff --git a/test/960-default-smali/src/Foo3.java b/test/960-default-smali/src/Foo3.java new file mode 100644 index 0000000000..4c00425937 --- /dev/null +++ b/test/960-default-smali/src/Foo3.java @@ -0,0 +1,22 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +interface Foo3 extends Foo { + default void doNothing() {} +} diff --git a/test/960-default-smali/src/N.java b/test/960-default-smali/src/N.java new file mode 100644 index 0000000000..9d33320fa7 --- /dev/null +++ b/test/960-default-smali/src/N.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +class N implements Foo { +} diff --git a/test/960-default-smali/src/O.java b/test/960-default-smali/src/O.java new file mode 100644 index 0000000000..55126af3ae --- /dev/null +++ b/test/960-default-smali/src/O.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +class O extends N implements Foo2 { +} diff --git a/test/960-default-smali/src/P.java b/test/960-default-smali/src/P.java new file mode 100644 index 0000000000..1ee6c26a6b --- /dev/null +++ b/test/960-default-smali/src/P.java @@ -0,0 +1,25 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +class P extends O implements Foo2 { + @Override + public String bar() { + return "not foobar!"; + } +} diff --git a/test/960-default-smali/src/Q.java b/test/960-default-smali/src/Q.java new file mode 100644 index 0000000000..bc1e1640cd --- /dev/null +++ b/test/960-default-smali/src/Q.java @@ -0,0 +1,21 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +class Q extends O implements Foo2, Foo3 { +} diff --git a/test/960-default-smali/src/classes.xml b/test/960-default-smali/src/classes.xml index f3e50c570b..c66d35b305 100644 --- a/test/960-default-smali/src/classes.xml +++ b/test/960-default-smali/src/classes.xml @@ -102,6 +102,37 @@ <method>bar</method> </methods> </class> + + <class name="N" super="java/lang/Object"> + <implements> + <item>Foo</item> + </implements> + <methods> </methods> + </class> + + <class name="O" super="N"> + <implements> + <item>Foo2</item> + </implements> + <methods> </methods> + </class> + + <class name="P" super="O"> + <implements> + <item>Foo2</item> + </implements> + <methods> + <method>bar</method> + </methods> + </class> + + <class name="Q" super="O"> + <implements> + <item>Foo2</item> + <item>Foo3</item> + </implements> + <methods> </methods> + </class> </classes> <interfaces> @@ -153,6 +184,24 @@ </methods> </interface> + <interface name="Foo2" super="java/lang/Object"> + <implements> + <item>Foo</item> + </implements> + <methods> + <method type="default">bar</method> + </methods> + </interface> + + <interface name="Foo3" super="java/lang/Object"> + <implements> + <item>Foo</item> + </implements> + <methods> + <method type="default">bar</method> + </methods> + </interface> + <interface name="Fooer" super="java/lang/Object"> <implements> <item>Foo</item> diff --git a/test/960-default-smali/src2/Foo.java b/test/960-default-smali/src2/Foo.java new file mode 100644 index 0000000000..ed5b35f47b --- /dev/null +++ b/test/960-default-smali/src2/Foo.java @@ -0,0 +1,20 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +interface Foo { + public default String bar() { + return "foobar"; + } +} diff --git a/test/960-default-smali/src2/Foo3.java b/test/960-default-smali/src2/Foo3.java new file mode 100644 index 0000000000..e96f98a48a --- /dev/null +++ b/test/960-default-smali/src2/Foo3.java @@ -0,0 +1,25 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Regression test for b/31280371 + */ +interface Foo3 extends Foo { + @Override + public default String bar() { + return "I'm in conflict"; + } +} diff --git a/test/Android.libarttest.mk b/test/Android.libarttest.mk index 5b1af277b9..97204d34c4 100644 --- a/test/Android.libarttest.mk +++ b/test/Android.libarttest.mk @@ -44,6 +44,7 @@ LIBARTTEST_COMMON_SRC_FILES := \ 566-polymorphic-inlining/polymorphic_inline.cc \ 570-checker-osr/osr.cc \ 595-profile-saving/profile-saving.cc \ + 596-app-images/app_images.cc \ 597-deopt-new-string/deopt.cc ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index b690f6300c..28b2c6e8ea 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -564,6 +564,13 @@ endif TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS := TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS := +TEST_ART_BROKEN_NPIC_RUN_TESTS := 596-app-images +ifneq (,$(filter npictest,$(PICTEST_TYPES))) + ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ + ${COMPILER_TYPES},$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ + $(IMAGE_TYPES),npictest,$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_NPIC_RUN_TESTS),$(ALL_ADDRESS_SIZES)) +endif + # Tests that should fail in the heap poisoning configuration with the Optimizing compiler. # 055: Exceeds run time limits due to heap poisoning instrumentation (on ARM and ARM64 devices). TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS := \ diff --git a/test/ImageLayoutA/ImageLayoutA.java b/test/ImageLayoutA/ImageLayoutA.java new file mode 100644 index 0000000000..0784ec267f --- /dev/null +++ b/test/ImageLayoutA/ImageLayoutA.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.HashMap; + +class MyClass { + static int i = 123; +} diff --git a/test/ImageLayoutB/ImageLayoutB.java b/test/ImageLayoutB/ImageLayoutB.java new file mode 100644 index 0000000000..a21c5e20fc --- /dev/null +++ b/test/ImageLayoutB/ImageLayoutB.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.HashMap; + +class MyClass { + public static String string = "ASDF_UNIQUE_STRING"; + public static HashMap<String, String> map = new HashMap<String, String>(); + static { + map.put("KEY_FOR_HASH_MAP", "VALUE_FOR_HASH_MAP"); + } +} diff --git a/test/Packages/Package1.java b/test/Packages/Package1.java new file mode 100644 index 0000000000..6d58246961 --- /dev/null +++ b/test/Packages/Package1.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package package1; +class Package1 { + static int someField; +} diff --git a/test/Packages/Package2.java b/test/Packages/Package2.java new file mode 100644 index 0000000000..9ae370a165 --- /dev/null +++ b/test/Packages/Package2.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package package2; +class Package2 { + static int someField; +} diff --git a/test/utils/python/generate_java_main.py b/test/utils/python/generate_java_main.py index f66d0dd372..1c76b06dda 100755 --- a/test/utils/python/generate_java_main.py +++ b/test/utils/python/generate_java_main.py @@ -175,7 +175,11 @@ class Func(mixins.Named, mixins.NameComparableMixin): return; }} catch (Error e) {{ System.out.printf("%s-{invoke_type} on {farg}: {callfunc}() threw exception!\\n", s); - e.printStackTrace(System.out); + if (e instanceof IncompatibleClassChangeError) {{ + System.out.printf("Exception is of type %s\\n", e.getClass().getName()); + }} else {{ + e.printStackTrace(System.out); + }} }} }} """ |