diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/831-unresolved-field/expected-stderr.txt | 0 | ||||
| -rw-r--r-- | test/831-unresolved-field/expected-stdout.txt | 0 | ||||
| -rw-r--r-- | test/831-unresolved-field/info.txt | 2 | ||||
| -rw-r--r-- | test/831-unresolved-field/run | 18 | ||||
| -rw-r--r-- | test/831-unresolved-field/smali/NonVerifiedClass.smali | 24 | ||||
| -rw-r--r-- | test/831-unresolved-field/smali/VerifiedClass.smali | 26 | ||||
| -rw-r--r-- | test/831-unresolved-field/src-dex2oat-unresolved/UnresolvedClass.java | 19 | ||||
| -rw-r--r-- | test/831-unresolved-field/src/Main.java | 29 | ||||
| -rw-r--r-- | test/knownfailures.json | 1 |
9 files changed, 119 insertions, 0 deletions
diff --git a/test/831-unresolved-field/expected-stderr.txt b/test/831-unresolved-field/expected-stderr.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/831-unresolved-field/expected-stderr.txt diff --git a/test/831-unresolved-field/expected-stdout.txt b/test/831-unresolved-field/expected-stdout.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/831-unresolved-field/expected-stdout.txt diff --git a/test/831-unresolved-field/info.txt b/test/831-unresolved-field/info.txt new file mode 100644 index 0000000000..ccdceaea3c --- /dev/null +++ b/test/831-unresolved-field/info.txt @@ -0,0 +1,2 @@ +Test that the verifier handles field assignments in constructors of unresolve +classes. diff --git a/test/831-unresolved-field/run b/test/831-unresolved-field/run new file mode 100644 index 0000000000..23424f60e1 --- /dev/null +++ b/test/831-unresolved-field/run @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright (C) 2021 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. + +# Use secondary switch to add secondary dex file to class path. +exec ${RUN} "${@}" --secondary diff --git a/test/831-unresolved-field/smali/NonVerifiedClass.smali b/test/831-unresolved-field/smali/NonVerifiedClass.smali new file mode 100644 index 0000000000..b263607b00 --- /dev/null +++ b/test/831-unresolved-field/smali/NonVerifiedClass.smali @@ -0,0 +1,24 @@ +# Copyright (C) 2021 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 LNonVerifiedSubClass; +.super LUnresolvedClass; + +.method public constructor <init>()V + .registers 2 + const/4 v0, 0x1 + iput v0, p0, LUnresolvedClass;->field:I + invoke-direct {p0}, LUnresolvedClass;-><init>()V + return-void +.end method diff --git a/test/831-unresolved-field/smali/VerifiedClass.smali b/test/831-unresolved-field/smali/VerifiedClass.smali new file mode 100644 index 0000000000..683181e430 --- /dev/null +++ b/test/831-unresolved-field/smali/VerifiedClass.smali @@ -0,0 +1,26 @@ +# Copyright (C) 2021 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 LVerifiedSubClass; +.super LUnresolvedClass; + +.field public localField:I + +.method public constructor <init>()V + .registers 2 + const/4 v0, 0x1 + iput v0, p0, LVerifiedSubClass;->localField:I + invoke-direct {p0}, LUnresolvedClass;-><init>()V + return-void +.end method diff --git a/test/831-unresolved-field/src-dex2oat-unresolved/UnresolvedClass.java b/test/831-unresolved-field/src-dex2oat-unresolved/UnresolvedClass.java new file mode 100644 index 0000000000..9550f404c2 --- /dev/null +++ b/test/831-unresolved-field/src-dex2oat-unresolved/UnresolvedClass.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 UnresolvedClass { + public int field; +} diff --git a/test/831-unresolved-field/src/Main.java b/test/831-unresolved-field/src/Main.java new file mode 100644 index 0000000000..66815074ff --- /dev/null +++ b/test/831-unresolved-field/src/Main.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2021 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) throws Exception { + Class<?> cls = Class.forName("VerifiedSubClass"); + cls.newInstance(); + + try { + Class.forName("NonVerifiedSubClass"); + throw new Error("Expected VerifyError"); + } catch (VerifyError e) { + // expected + } + } +} diff --git a/test/knownfailures.json b/test/knownfailures.json index ac71c66fa9..e7ed208eea 100644 --- a/test/knownfailures.json +++ b/test/knownfailures.json @@ -1158,6 +1158,7 @@ "827-resolve-method", "830-goto-zero", "831-unverified-bcp", + "831-unresolved-field", "999-redefine-hiddenapi", "1000-non-moving-space-stress", "1001-app-image-regions", |