diff options
Diffstat (limited to 'test')
23 files changed, 302 insertions, 6 deletions
diff --git a/test/485-checker-dce-loop-update/smali/TestCase.smali b/test/485-checker-dce-loop-update/smali/TestCase.smali index da27bf6cf1..ab4afdb547 100644 --- a/test/485-checker-dce-loop-update/smali/TestCase.smali +++ b/test/485-checker-dce-loop-update/smali/TestCase.smali @@ -141,7 +141,7 @@ ## CHECK-DAG: If [<<ArgY>>] loop:<<HeaderY>> ## CHECK-DAG: If [<<ArgZ>>] loop:<<HeaderY>> ## CHECK-DAG: <<Mul9:i\d+>> Mul [<<PhiX1>>,<<Cst9>>] loop:<<HeaderY>> -## CHECK-DAG: <<PhiX2:i\d+>> Phi [<<Mul9>>,<<PhiX1>>] loop:<<HeaderY>> +## CHECK-DAG: <<PhiX2:i\d+>> Phi [<<PhiX1>>,<<Mul9>>] loop:<<HeaderY>> ## CHECK-DAG: If [<<Cst1>>] loop:<<HeaderY>> ## CHECK-DAG: <<Add5>> Add [<<PhiX2>>,<<Cst5>>] loop:<<HeaderY>> ## CHECK-DAG: <<Add7>> Add [<<PhiX1>>,<<Cst7>>] loop:<<HeaderY>> @@ -158,7 +158,7 @@ ## CHECK-DAG: <<Add7>> Add [<<PhiX1>>,<<Cst7>>] loop:<<HeaderY>> ## CHECK-DAG: If [<<ArgZ>>] loop:none ## CHECK-DAG: <<Mul9:i\d+>> Mul [<<PhiX1>>,<<Cst9>>] loop:none -## CHECK-DAG: <<PhiX2:i\d+>> Phi [<<Mul9>>,<<PhiX1>>] loop:none +## CHECK-DAG: <<PhiX2:i\d+>> Phi [<<PhiX1>>,<<Mul9>>] loop:none ## CHECK-DAG: Return [<<PhiX2>>] loop:none .method public static testExitPredecessors(IZZ)I diff --git a/test/496-checker-inlining-and-class-loader/src/Main.java b/test/496-checker-inlining-and-class-loader/src/Main.java index f6d0b41a58..4f23eec4a0 100644 --- a/test/496-checker-inlining-and-class-loader/src/Main.java +++ b/test/496-checker-inlining-and-class-loader/src/Main.java @@ -106,7 +106,7 @@ class LoadedByMyClassLoader { } } -class Main { +public class Main { public static void main(String[] args) throws Exception { MyClassLoader o = new MyClassLoader(); Class foo = o.loadClass("LoadedByMyClassLoader"); diff --git a/test/506-verify-aput/expected.txt b/test/506-verify-aput/expected.txt new file mode 100644 index 0000000000..ccaf6f8f0f --- /dev/null +++ b/test/506-verify-aput/expected.txt @@ -0,0 +1 @@ +Enter diff --git a/test/506-verify-aput/info.txt b/test/506-verify-aput/info.txt new file mode 100644 index 0000000000..461d9d37ad --- /dev/null +++ b/test/506-verify-aput/info.txt @@ -0,0 +1,2 @@ +Test that an aput on a null array is properly checked +by the verifier. diff --git a/test/506-verify-aput/smali/VerifyAPut1.smali b/test/506-verify-aput/smali/VerifyAPut1.smali new file mode 100644 index 0000000000..d50636f4f2 --- /dev/null +++ b/test/506-verify-aput/smali/VerifyAPut1.smali @@ -0,0 +1,26 @@ +# Copyright (C) 2015 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 public LVerifyAPut1; + +.super Ljava/lang/Object; + +.method public static method()V + .registers 3 + const/4 v0, 0 + const/4 v1, 1 + const/4 v2, 2 + aput-object v2, v0, v1 + return-void +.end method diff --git a/test/506-verify-aput/smali/VerifyAPut2.smali b/test/506-verify-aput/smali/VerifyAPut2.smali new file mode 100644 index 0000000000..2eceebb95d --- /dev/null +++ b/test/506-verify-aput/smali/VerifyAPut2.smali @@ -0,0 +1,25 @@ +# Copyright (C) 2015 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 public LVerifyAPut2; + +.super Ljava/lang/Object; + +.method public static method(LMain;)V + .registers 3 + const/4 v0, 0 + const/4 v1, 1 + aput p0, v0, v1 + return-void +.end method diff --git a/test/506-verify-aput/src/Main.java b/test/506-verify-aput/src/Main.java new file mode 100644 index 0000000000..8359f2c452 --- /dev/null +++ b/test/506-verify-aput/src/Main.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 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.lang.reflect.Method; + +public class Main { + public static void main(String[] args) throws Exception { + // Workaround for b/18051191. + System.out.println("Enter"); + try { + Class.forName("VerifyAPut1"); + throw new Error("expected verification error"); + } catch (VerifyError e) { /* ignore */ } + + try { + Class.forName("VerifyAPut2"); + throw new Error("expected verification error"); + } catch (VerifyError e) { /* ignore */ } + } +} diff --git a/test/507-boolean-test/expected.txt b/test/507-boolean-test/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/507-boolean-test/expected.txt diff --git a/test/507-boolean-test/info.txt b/test/507-boolean-test/info.txt new file mode 100644 index 0000000000..15c20c1ec0 --- /dev/null +++ b/test/507-boolean-test/info.txt @@ -0,0 +1,2 @@ +Regression test for the optimizing compiler that used to +crash when compiling (a ? 1 : 0) == 2. diff --git a/test/507-boolean-test/src/Main.java b/test/507-boolean-test/src/Main.java new file mode 100644 index 0000000000..f3ce92a644 --- /dev/null +++ b/test/507-boolean-test/src/Main.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2015 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. + */ + +public class Main { + public static void main(String[] args) { + if (bar(true)) { + throw new Error("Expected false, got true"); + } + } + + public static boolean bar(boolean a) { + return (a ? 0 : 1) == 2; + } +} diff --git a/test/507-referrer/expected.txt b/test/507-referrer/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/507-referrer/expected.txt diff --git a/test/507-referrer/info.txt b/test/507-referrer/info.txt new file mode 100644 index 0000000000..1335994d07 --- /dev/null +++ b/test/507-referrer/info.txt @@ -0,0 +1,2 @@ +Regression test for the optimizing compiler, which used +to do incorrect access checks on static fields when inlining. diff --git a/test/507-referrer/src/Main.java b/test/507-referrer/src/Main.java new file mode 100644 index 0000000000..6393f39965 --- /dev/null +++ b/test/507-referrer/src/Main.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2015 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 p1.InPackage; + +public class Main { + public static void main(String[] args) { + int result = InPackage.$inline$foo(); + if (result != 42) { + throw new Error("Expected 42, got " + result); + } + } +} diff --git a/test/507-referrer/src/p1/InPackage.java b/test/507-referrer/src/p1/InPackage.java new file mode 100644 index 0000000000..162f055121 --- /dev/null +++ b/test/507-referrer/src/p1/InPackage.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2015 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 p1; + +public class InPackage { + public static int $inline$foo() { + return myField; + } + + protected static int myField = 42; +} diff --git a/test/509-pre-header/expected.txt b/test/509-pre-header/expected.txt new file mode 100644 index 0000000000..ccaf6f8f0f --- /dev/null +++ b/test/509-pre-header/expected.txt @@ -0,0 +1 @@ +Enter diff --git a/test/509-pre-header/info.txt b/test/509-pre-header/info.txt new file mode 100644 index 0000000000..e9d8b9411e --- /dev/null +++ b/test/509-pre-header/info.txt @@ -0,0 +1,3 @@ +Regression test for the SimplifyCFG phase of optimizing. +The invariant that the pre header of a loop header is the +first predecessor was not preserved. diff --git a/test/509-pre-header/smali/PreHeader.smali b/test/509-pre-header/smali/PreHeader.smali new file mode 100644 index 0000000000..04f4e4950c --- /dev/null +++ b/test/509-pre-header/smali/PreHeader.smali @@ -0,0 +1,39 @@ +# Copyright (C) 2015 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 public LPreHeader; + +.super Ljava/lang/Object; + +# Label names in this method are taken from the original apk +# that exposed the crash. The crash was due to fixing a critical +# edge and not preserving the invariant that the pre header of a loop +# is the first predecessor of the loop header. +.method public static method()V + .registers 2 + const/4 v0, 0 + const/4 v1, 0 + goto :b31 + :b23 + if-eqz v0, :b25 + goto :b23 + :b25 + return-void + :b31 + if-eqz v0, :b23 + if-eqz v1, :bexit + goto :b31 + :bexit + return-void +.end method diff --git a/test/509-pre-header/src/Main.java b/test/509-pre-header/src/Main.java new file mode 100644 index 0000000000..1eca41978c --- /dev/null +++ b/test/509-pre-header/src/Main.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2015 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.lang.reflect.Method; + +public class Main { + public static void main(String[] args) throws Exception { + // Workaround for b/18051191. + System.out.println("Enter"); + Class<?> c = Class.forName("PreHeader"); + Method m = c.getMethod("method"); + Object[] arguments = { }; + m.invoke(null, arguments); + } +} diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index 3c6506b6b4..6c00c82983 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -17,6 +17,7 @@ MoveExceptionOnEntry EmptySparseSwitch b/20224106 b/17410612 -b/21865464 +b/21863767 b/21873167 +b/21614284 Done! diff --git a/test/800-smali/smali/b_21614284.smali b/test/800-smali/smali/b_21614284.smali new file mode 100644 index 0000000000..3cb1bd0ce2 --- /dev/null +++ b/test/800-smali/smali/b_21614284.smali @@ -0,0 +1,22 @@ +.class public LB21614284; +.super Ljava/lang/Object; + +.field private a:I + +.method public constructor <init>()V + .registers 2 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + const v0, 42 + iput v0, p0, LB21614284;->a:I + return-void +.end method + +.method public static test(LB21614284;)I + .registers 2 + # Empty if, testing p0. + if-nez p0, :label + :label + # p0 still needs a null check. + iget v0, p0, LB21614284;->a:I + return v0 +.end method diff --git a/test/800-smali/smali/b_21865464.smali b/test/800-smali/smali/b_21863767.smali index df56a54aaa..9b33bc382d 100644 --- a/test/800-smali/smali/b_21865464.smali +++ b/test/800-smali/smali/b_21863767.smali @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -.class public LB21865464; +.class public LB21863767; .super Ljava/lang/Object; diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index d1c275cfef..ab4457e919 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -83,9 +83,11 @@ public class Main { 0)); testCases.add(new TestCase("b/17410612", "B17410612", "run", null, new VerifyError(), 0)); - testCases.add(new TestCase("b/21865464", "B21865464", "run", null, null, + testCases.add(new TestCase("b/21863767", "B21863767", "run", null, null, null)); testCases.add(new TestCase("b/21873167", "B21873167", "test", null, null, null)); + testCases.add(new TestCase("b/21614284", "B21614284", "test", new Object[] { null }, + new NullPointerException(), null)); } public void runTests() { diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index c2380cc668..60165d93dd 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -398,6 +398,37 @@ endif TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS := +# Known broken tests for the MIPS64 optimizing compiler backend in 64-bit mode. b/21555893 +TEST_ART_BROKEN_OPTIMIZING_MIPS64_64BIT_RUN_TESTS := \ + 004-SignalTest \ + 018-stack-overflow \ + 107-int-math2 \ + 449-checker-bce + +ifeq ($(TARGET_ARCH),mips64) + ifneq (,$(filter optimizing,$(COMPILER_TYPES))) + ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \ + optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ + $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_OPTIMIZING_MIPS64_64BIT_RUN_TESTS),64) + endif +endif + +TEST_ART_BROKEN_OPTIMIZING_MIPS64_64BIT_RUN_TESTS := + +# Known broken tests for the MIPS64 optimizing compiler backend in 32-bit mode. b/21555893 +TEST_ART_BROKEN_OPTIMIZING_MIPS64_32BIT_RUN_TESTS := \ + 496-checker-inlining-and-class-loader + +ifeq ($(TARGET_ARCH),mips64) + ifneq (,$(filter optimizing,$(COMPILER_TYPES))) + ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \ + optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ + $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_OPTIMIZING_MIPS64_32BIT_RUN_TESTS),32) + endif +endif + +TEST_ART_BROKEN_OPTIMIZING_MIPS64_32BIT_RUN_TESTS := + # Known broken tests for the optimizing compiler. TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS := |