diff options
33 files changed, 1290 insertions, 168 deletions
diff --git a/cmdline/Android.bp b/cmdline/Android.bp index 741722f38d..fdc762caaa 100644 --- a/cmdline/Android.bp +++ b/cmdline/Android.bp @@ -36,10 +36,26 @@ cc_library_headers { min_sdk_version: "S", } +art_cc_defaults { + name: "art_cmdline_tests_defaults", + srcs: ["cmdline_parser_test.cc"], +} + +// Version of ART gtest `art_cmdline_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. art_cc_test { name: "art_cmdline_tests", defaults: [ "art_gtest_defaults", + "art_cmdline_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_cmdline_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_cmdline_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_cmdline_tests_defaults", ], - srcs: ["cmdline_parser_test.cc"], } diff --git a/compiler/Android.bp b/compiler/Android.bp index 86f1712cb7..6b74f77b73 100644 --- a/compiler/Android.bp +++ b/compiler/Android.bp @@ -326,26 +326,47 @@ cc_defaults { whole_static_libs: ["libartd-compiler"], } -art_cc_library { - name: "libartd-compiler-gtest", - defaults: ["libartd-gtest-defaults"], +// Properties common to `libart-compiler-gtest` and `libartd-compiler-gtest`. +art_cc_defaults { + name: "libart-compiler-gtest-common", srcs: [ "common_compiler_test.cc", ], shared_libs: [ + "libbase", + ], +} + +art_cc_library { + name: "libart-compiler-gtest", + defaults: [ + "libart-gtest-defaults", + "libart-compiler-gtest-common", + ], + shared_libs: [ + "libart-compiler", + "libart-disassembler", + "libartbase-art-gtest", + "libart-runtime-gtest", + ], +} + +art_cc_library { + name: "libartd-compiler-gtest", + defaults: [ + "libartd-gtest-defaults", + "libart-compiler-gtest-common", + ], + shared_libs: [ "libartd-compiler", "libartd-disassembler", "libartbased-art-gtest", "libartd-runtime-gtest", - "libbase", ], } -art_cc_test { - name: "art_compiler_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_compiler_tests_defaults", data: [ ":art-gtest-jars-ExceptionHandle", ":art-gtest-jars-Interfaces", @@ -436,16 +457,9 @@ art_cc_test { ], shared_libs: [ - "libprofiled", - "libartd-compiler", - "libartd-simulator-container", - "libbacktrace", "libnativeloader", ], - static_libs: [ - "libvixld", - ], target: { host: { @@ -456,6 +470,47 @@ art_cc_test { }, } +// Version of ART gtest `art_compiler_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_compiler_tests", + defaults: [ + "art_gtest_defaults", + "art_compiler_tests_defaults", + ], + shared_libs: [ + "libprofiled", + "libartd-compiler", + "libartd-simulator-container", + ], + static_libs: [ + "libvixld", + ], +} + +// Standalone version of ART gtest `art_compiler_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_compiler_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_compiler_tests_defaults", + ], + shared_libs: [ + "libprofile", + "libart-compiler", + ], + static_libs: [ + // For now, link `libart-simulator-container` statically for simplicity, + // to save the added complexity to package it in test suites (along with + // other test artifacts) and install it on device during tests. + // TODO(b/192070541): Consider linking `libart-simulator-container` + // dynamically. + "libart-simulator-container", + "libvixl", + ], + test_config: "art_standalone_compiler_tests.xml", +} + art_cc_test { name: "art_compiler_host_tests", device_supported: false, diff --git a/compiler/art_standalone_compiler_tests.xml b/compiler/art_standalone_compiler_tests.xml new file mode 100644 index 0000000000..0e6702293f --- /dev/null +++ b/compiler/art_standalone_compiler_tests.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_compiler_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_compiler_tests->/data/local/tmp/nativetest/art_standalone_compiler_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-ExceptionHandle.jar->/data/local/tmp/nativetest/art-gtest-jars-ExceptionHandle.jar" /> + <option name="push" value="art-gtest-jars-Interfaces.jar->/data/local/tmp/nativetest/art-gtest-jars-Interfaces.jar" /> + <option name="push" value="art-gtest-jars-MyClassNatives.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClassNatives.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_compiler_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/compiler/optimizing/ssa_liveness_analysis.h b/compiler/optimizing/ssa_liveness_analysis.h index 3ea2815e64..7f31585f34 100644 --- a/compiler/optimizing/ssa_liveness_analysis.h +++ b/compiler/optimizing/ssa_liveness_analysis.h @@ -873,9 +873,9 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> { } // Returns whether an interval, when it is non-split, is using - // the same register of one of its input. + // the same register of one of its input. This function should + // be used only for DCHECKs. bool IsUsingInputRegister() const { - CHECK(kIsDebugBuild) << "Function should be used only for DCHECKs"; if (defined_by_ != nullptr && !IsSplit()) { for (const HInstruction* input : defined_by_->GetInputs()) { LiveInterval* interval = input->GetLiveInterval(); @@ -899,9 +899,9 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> { // Returns whether an interval, when it is non-split, can safely use // the same register of one of its input. Note that this method requires - // IsUsingInputRegister() to be true. + // IsUsingInputRegister() to be true. This function should be used only + // for DCHECKs. bool CanUseInputRegister() const { - CHECK(kIsDebugBuild) << "Function should be used only for DCHECKs"; DCHECK(IsUsingInputRegister()); if (defined_by_ != nullptr && !IsSplit()) { LocationSummary* locations = defined_by_->GetLocations(); diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp index a232b55db5..d377bbbe95 100644 --- a/dex2oat/Android.bp +++ b/dex2oat/Android.bp @@ -412,6 +412,26 @@ art_cc_binary { } art_cc_library_static { + name: "libart-dex2oat-gtest", + defaults: ["libart-gtest-defaults"], + srcs: [ + "common_compiler_driver_test.cc", + ], + shared_libs: [ + "libart-compiler-gtest", + "libart-runtime-gtest", + "libart-compiler", + "libart-disassembler", + "libbase", + "liblz4", // libart-dex2oat dependency; must be repeated here since it's a static lib. + "liblog", + ], + static_libs: [ + "libart-dex2oat", + ], +} + +art_cc_library_static { name: "libartd-dex2oat-gtest", defaults: ["libartd-gtest-defaults"], srcs: [ @@ -431,11 +451,8 @@ art_cc_library_static { ], } -art_cc_test { - name: "art_dex2oat_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_dex2oat_tests_defaults", data: [ ":art-gtest-jars-AbstractMethod", ":art-gtest-jars-DefaultMethods", @@ -506,20 +523,54 @@ art_cc_test { }, shared_libs: [ - "libartbased", - "libartd-compiler", - "libartd-dexlayout", "libartpalette", "libbase", "libcrypto", - "liblz4", // libartd-dex2oat dependency; must be repeated here since it's a static lib. + "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. "liblog", - "libprofiled", "libsigchain", "libziparchive", ], +} + +// Version of ART gtest `art_dex2oat_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_dex2oat_tests", + defaults: [ + "art_gtest_defaults", + "art_dex2oat_tests_defaults", + ], + shared_libs: [ + "libartbased", + "libartd-compiler", + "libartd-dexlayout", + "libprofiled", + ], static_libs: [ "libartd-dex2oat-gtest", "libartd-dex2oat", + "libvixld", + ], +} + +// Standalone version of ART gtest `art_dex2oat_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_dex2oat_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_dex2oat_tests_defaults", + ], + shared_libs: [ + "libartbase", + "libart-compiler", + "libart-dexlayout", + "libprofile", + ], + static_libs: [ + "libart-dex2oat-gtest", + "libart-dex2oat", + "libvixl", ], + test_config: "art_standalone_dex2oat_tests.xml", } diff --git a/dex2oat/art_standalone_dex2oat_tests.xml b/dex2oat/art_standalone_dex2oat_tests.xml new file mode 100644 index 0000000000..8cc89268be --- /dev/null +++ b/dex2oat/art_standalone_dex2oat_tests.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_dex2oat_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_dex2oat_tests->/data/local/tmp/nativetest/art_standalone_dex2oat_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-AbstractMethod.jar->/data/local/tmp/nativetest/art-gtest-jars-AbstractMethod.jar" /> + <option name="push" value="art-gtest-jars-DefaultMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-DefaultMethods.jar" /> + <option name="push" value="art-gtest-jars-DexToDexDecompiler.jar->/data/local/tmp/nativetest/art-gtest-jars-DexToDexDecompiler.jar" /> + <option name="push" value="art-gtest-jars-Dex2oatVdexPublicSdkDex.dex->/data/local/tmp/nativetest/art-gtest-jars-Dex2oatVdexPublicSdkDex.dex" /> + <option name="push" value="art-gtest-jars-Dex2oatVdexTestDex.jar->/data/local/tmp/nativetest/art-gtest-jars-Dex2oatVdexTestDex.jar" /> + <option name="push" value="art-gtest-jars-ImageLayoutA.jar->/data/local/tmp/nativetest/art-gtest-jars-ImageLayoutA.jar" /> + <option name="push" value="art-gtest-jars-ImageLayoutB.jar->/data/local/tmp/nativetest/art-gtest-jars-ImageLayoutB.jar" /> + <option name="push" value="art-gtest-jars-LinkageTest.dex->/data/local/tmp/nativetest/art-gtest-jars-LinkageTest.dex" /> + <option name="push" value="art-gtest-jars-Main.jar->/data/local/tmp/nativetest/art-gtest-jars-Main.jar" /> + <option name="push" value="art-gtest-jars-MainEmptyUncompressed.jar->/data/local/tmp/nativetest/art-gtest-jars-MainEmptyUncompressed.jar" /> + <option name="push" value="art-gtest-jars-MainEmptyUncompressedAligned.jar->/data/local/tmp/nativetest/art-gtest-jars-MainEmptyUncompressedAligned.jar" /> + <option name="push" value="art-gtest-jars-MainStripped.jar->/data/local/tmp/nativetest/art-gtest-jars-MainStripped.jar" /> + <option name="push" value="art-gtest-jars-MainUncompressedAligned.jar->/data/local/tmp/nativetest/art-gtest-jars-MainUncompressedAligned.jar" /> + <option name="push" value="art-gtest-jars-ManyMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-ManyMethods.jar" /> + <option name="push" value="art-gtest-jars-MultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDex.jar" /> + <option name="push" value="art-gtest-jars-MultiDexModifiedSecondary.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDexModifiedSecondary.jar" /> + <option name="push" value="art-gtest-jars-MyClassNatives.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClassNatives.jar" /> + <option name="push" value="art-gtest-jars-Nested.jar->/data/local/tmp/nativetest/art-gtest-jars-Nested.jar" /> + <option name="push" value="art-gtest-jars-ProfileTestMultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-ProfileTestMultiDex.jar" /> + <option name="push" value="art-gtest-jars-StaticLeafMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-StaticLeafMethods.jar" /> + <option name="push" value="art-gtest-jars-Statics.jar->/data/local/tmp/nativetest/art-gtest-jars-Statics.jar" /> + <option name="push" value="art-gtest-jars-StringLiterals.jar->/data/local/tmp/nativetest/art-gtest-jars-StringLiterals.jar" /> + <option name="push" value="art-gtest-jars-VerifierDeps.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDeps.dex" /> + <option name="push" value="art-gtest-jars-VerifierDepsMulti.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDepsMulti.dex" /> + <option name="push" value="art-gtest-jars-VerifySoftFailDuringClinit.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifySoftFailDuringClinit.dex" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_dex2oat_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/dexdump/Android.bp b/dexdump/Android.bp index 0115b3828f..31faa3459f 100644 --- a/dexdump/Android.bp +++ b/dexdump/Android.bp @@ -71,11 +71,8 @@ art_cc_binary { ], } -art_cc_test { - name: "art_dexdump_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_dexdump_tests_defaults", srcs: ["dexdump_test.cc"], target: { host: { @@ -83,3 +80,22 @@ art_cc_test { }, }, } + +// Version of ART gtest `art_dexdump_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_dexdump_tests", + defaults: [ + "art_gtest_defaults", + "art_dexdump_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_dexdump_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_dexdump_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_dexdump_tests_defaults", + ], +} diff --git a/dexlist/Android.bp b/dexlist/Android.bp index ae743e9688..1e69bdcce7 100644 --- a/dexlist/Android.bp +++ b/dexlist/Android.bp @@ -57,11 +57,8 @@ art_cc_binary { }, } -art_cc_test { - name: "art_dexlist_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_dexlist_tests_defaults", srcs: ["dexlist_test.cc"], target: { host: { @@ -69,3 +66,22 @@ art_cc_test { }, }, } + +// Version of ART gtest `art_dexlist_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_dexlist_tests", + defaults: [ + "art_gtest_defaults", + "art_dexlist_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_dexlist_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_dexlist_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_dexlist_tests_defaults", + ], +} diff --git a/dexoptanalyzer/Android.bp b/dexoptanalyzer/Android.bp index 02c385a582..8efaf28ddf 100644 --- a/dexoptanalyzer/Android.bp +++ b/dexoptanalyzer/Android.bp @@ -82,11 +82,8 @@ art_cc_binary { ], } -art_cc_test { - name: "art_dexoptanalyzer_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_dexoptanalyzer_tests_defaults", shared_libs: [ "libbacktrace", ], @@ -111,3 +108,24 @@ art_cc_test { }, }, } + +// Version of ART gtest `art_dexoptanalyzer_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_dexoptanalyzer_tests", + defaults: [ + "art_gtest_defaults", + "art_dexoptanalyzer_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_dexoptanalyzer_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_dexoptanalyzer_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_dexoptanalyzer_tests_defaults", + ], + test_config_template: "art_standalone_dexoptanalyzer_tests.xml", +} diff --git a/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml new file mode 100644 index 0000000000..800dec1684 --- /dev/null +++ b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_dexoptanalyzer_tests (as root)."> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_dexoptanalyzer_tests->/data/local/tmp/nativetest/art_standalone_dexoptanalyzer_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-LinkageTest.dex->/data/local/tmp/nativetest/art-gtest-jars-LinkageTest.dex" /> + <option name="push" value="art-gtest-jars-Main.jar->/data/local/tmp/nativetest/art-gtest-jars-Main.jar" /> + <option name="push" value="art-gtest-jars-MainStripped.jar->/data/local/tmp/nativetest/art-gtest-jars-MainStripped.jar" /> + <option name="push" value="art-gtest-jars-MultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDex.jar" /> + <option name="push" value="art-gtest-jars-MultiDexModifiedSecondary.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDexModifiedSecondary.jar" /> + <option name="push" value="art-gtest-jars-MyClassNatives.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClassNatives.jar" /> + <option name="push" value="art-gtest-jars-Nested.jar->/data/local/tmp/nativetest/art-gtest-jars-Nested.jar" /> + <option name="push" value="art-gtest-jars-VerifierDeps.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDeps.dex" /> + <option name="push" value="art-gtest-jars-VerifierDepsMulti.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDepsMulti.dex" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_dexoptanalyzer_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/libartbase/Android.bp b/libartbase/Android.bp index 2b2839718d..8bd3bd12aa 100644 --- a/libartbase/Android.bp +++ b/libartbase/Android.bp @@ -221,15 +221,12 @@ art_cc_library { }, } -art_cc_library { - name: "libartbased-art-gtest", - defaults: ["libartd-gtest-defaults"], +art_cc_defaults { + name: "libartbase-art-gtest-defaults", srcs: [ "base/common_art_test.cc", ], shared_libs: [ - "libartbased", - "libdexfiled", "libbase", "libbacktrace", ], @@ -244,11 +241,32 @@ art_cc_library { }, } -art_cc_test { - name: "art_libartbase_tests", +art_cc_library { + name: "libartbase-art-gtest", defaults: [ - "art_gtest_defaults", + "libart-gtest-defaults", + "libartbase-art-gtest-defaults", + ], + shared_libs: [ + "libartbase", + "libdexfile", ], +} + +art_cc_library { + name: "libartbased-art-gtest", + defaults: [ + "libartd-gtest-defaults", + "libartbase-art-gtest-defaults", + ], + shared_libs: [ + "libartbased", + "libdexfiled", + ], +} + +art_cc_defaults { + name: "art_libartbase_tests_defaults", srcs: [ "arch/instruction_set_test.cc", "base/arena_allocator_test.cc", @@ -288,6 +306,28 @@ art_cc_test { shared_libs: [ "libbase", ], + static_libs: [ + "libgmock", + ], +} + +// Version of ART gtest `art_libartbase_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libartbase_tests", + defaults: [ + "art_gtest_defaults", + "art_libartbase_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_libartbase_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_libartbase_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libartbase_tests_defaults", + ], } cc_library_headers { diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc index c81cbc6336..843f2862d1 100644 --- a/libartbase/base/common_art_test.cc +++ b/libartbase/base/common_art_test.cc @@ -322,10 +322,12 @@ void CommonArtTestImpl::SetUp() { mkdir_result = mkdir(dalvik_cache_.c_str(), 0700); ASSERT_EQ(mkdir_result, 0); - static bool gSlowDebugTestFlag = false; - RegisterRuntimeDebugFlag(&gSlowDebugTestFlag); - SetRuntimeDebugFlagsEnabled(true); - CHECK(gSlowDebugTestFlag); + if (kIsDebugBuild) { + static bool gSlowDebugTestFlag = false; + RegisterRuntimeDebugFlag(&gSlowDebugTestFlag); + SetRuntimeDebugFlagsEnabled(true); + CHECK(gSlowDebugTestFlag); + } } void CommonArtTestImpl::TearDownAndroidDataDir(const std::string& android_data, diff --git a/libartbase/base/logging_test.cc b/libartbase/base/logging_test.cc index 46ba41bb1f..540b9a7ef4 100644 --- a/libartbase/base/logging_test.cc +++ b/libartbase/base/logging_test.cc @@ -39,10 +39,6 @@ class LoggingTest : public testing::Test { } }; -#ifdef NDEBUG -#error Unexpected NDEBUG -#endif - class TestClass { public: DECLARE_RUNTIME_DEBUG_FLAG(kFlag); @@ -51,7 +47,12 @@ DEFINE_RUNTIME_DEBUG_FLAG(TestClass, kFlag); TEST_F(LoggingTest, DECL_DEF) { SetRuntimeDebugFlagsEnabled(true); - EXPECT_TRUE(TestClass::kFlag); + if (kIsDebugBuild) { + EXPECT_TRUE(TestClass::kFlag); + } else { + // Runtime debug flags have a constant `false` value on non-debug builds. + EXPECT_FALSE(TestClass::kFlag); + } SetRuntimeDebugFlagsEnabled(false); EXPECT_FALSE(TestClass::kFlag); diff --git a/libartbase/base/utils_test.cc b/libartbase/base/utils_test.cc index 09705fe862..ab8627fa7d 100644 --- a/libartbase/base/utils_test.cc +++ b/libartbase/base/utils_test.cc @@ -17,6 +17,7 @@ #include "utils.h" #include "stl_util.h" +#include "gmock/gmock.h" #include "gtest/gtest.h" namespace art { @@ -113,7 +114,10 @@ TEST_F(UtilsTest, Split) { } TEST_F(UtilsTest, GetProcessStatus) { - EXPECT_EQ("art_libartbase_", GetProcessStatus("Name")); + EXPECT_THAT(GetProcessStatus("Name"), + testing::AnyOf( + "art_libartbase_", // Test binary name: `art_libartbase_test`. + "art_standalone_")); // Test binary name: `art_standalone_libartbase_test`. EXPECT_EQ("R (running)", GetProcessStatus("State")); EXPECT_EQ("<unknown>", GetProcessStatus("tate")); EXPECT_EQ("<unknown>", GetProcessStatus("e")); diff --git a/libartpalette/Android.bp b/libartpalette/Android.bp index e8b7fd82d6..19d12c7f33 100644 --- a/libartpalette/Android.bp +++ b/libartpalette/Android.bp @@ -119,10 +119,29 @@ art_cc_library { ], } +art_cc_defaults { + name: "art_libartpalette_tests_defaults", + srcs: ["apex/palette_test.cc"], + shared_libs: ["libartpalette"], +} + +// Version of ART gtest `art_libartpalette_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. art_cc_test { name: "art_libartpalette_tests", - defaults: ["art_gtest_defaults"], + defaults: [ + "art_gtest_defaults", + "art_libartpalette_tests_defaults", + ], host_supported: true, - srcs: ["apex/palette_test.cc"], - shared_libs: ["libartpalette"], +} + +// Standalone version of ART gtest `art_libartpalette_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_libartpalette_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libartpalette_tests_defaults", + ], } diff --git a/libartservice/Android.bp b/libartservice/Android.bp index 5f8a296309..18c851ee99 100644 --- a/libartservice/Android.bp +++ b/libartservice/Android.bp @@ -99,11 +99,8 @@ java_sdk_library { dist_group: "android", } -art_cc_test { - name: "art_libartservice_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_libartservice_tests_defaults", srcs: [ "service/native/service_test.cc", ], @@ -112,3 +109,23 @@ art_cc_test { "libartservice", ], } + +// Version of ART gtest `art_libartservice_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libartservice_tests", + defaults: [ + "art_gtest_defaults", + "art_libartservice_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_libartservice_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_libartservice_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libartservice_tests_defaults", + ], +} diff --git a/libarttools/Android.bp b/libarttools/Android.bp index 5e654bbad7..3df40a5daf 100644 --- a/libarttools/Android.bp +++ b/libarttools/Android.bp @@ -46,11 +46,8 @@ cc_library { export_shared_lib_headers: ["libbase"], } -art_cc_test { - name: "art_libarttools_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_libarttools_tests_defaults", srcs: [ "tools/tools_test.cc", ], @@ -59,3 +56,23 @@ art_cc_test { "libarttools", ], } + +// Version of ART gtest `art_libarttools_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libarttools_tests", + defaults: [ + "art_gtest_defaults", + "art_libarttools_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_libarttools_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_libarttools_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libarttools_tests_defaults", + ], +} diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp index 50933ecc4d..c6d445e0ff 100644 --- a/libdexfile/Android.bp +++ b/libdexfile/Android.bp @@ -255,11 +255,8 @@ art_cc_library { ], } -art_cc_test { - name: "art_libdexfile_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_libdexfile_tests_defaults", srcs: [ "dex/art_dex_file_loader_test.cc", "dex/class_accessor_test.cc", @@ -290,6 +287,26 @@ art_cc_test { ], } +// Version of ART gtest `art_libdexfile_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libdexfile_tests", + defaults: [ + "art_gtest_defaults", + "art_libdexfile_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_libdexfile_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_libdexfile_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libdexfile_tests_defaults", + ], + test_config: "art_standalone_libdexfile_tests.xml", +} + cc_library_headers { name: "libdexfile_external_headers", visibility: ["//visibility:public"], @@ -382,13 +399,11 @@ art_cc_library_static { min_sdk_version: "S", } -art_cc_test { - name: "art_libdexfile_support_tests", +art_cc_defaults { + name: "art_libdexfile_support_tests_defaults", defaults: [ "art_module_source_build_defaults", - "art_test_defaults", ], - host_supported: true, test_suites: ["general-tests"], srcs: [ "external/dex_file_supp_test.cc", @@ -404,6 +419,40 @@ art_cc_test { ], } +// Version of ART gtest `art_libdexfile_support_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libdexfile_support_tests", + host_supported: true, + defaults: [ + "art_test_defaults", + "art_libdexfile_support_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_libdexfile_support_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_libdexfile_support_tests", + defaults: [ + "art_standalone_test_defaults", + "art_libdexfile_support_tests_defaults", + ], + + // Support multilib variants (using different suffix per sub-architecture), which is needed on + // build targets with secondary architectures, as the MTS test suite packaging logic flattens + // all test artifacts into a single `testcases` directory. + compile_multilib: "both", + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, +} + cc_library_static { name: "libdexfile_support_static", host_supported: true, diff --git a/libdexfile/art_standalone_libdexfile_tests.xml b/libdexfile/art_standalone_libdexfile_tests.xml new file mode 100644 index 0000000000..f8c0019383 --- /dev/null +++ b/libdexfile/art_standalone_libdexfile_tests.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_libdexfile_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_libdexfile_tests->/data/local/tmp/nativetest/art_standalone_libdexfile_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-GetMethodSignature.jar->/data/local/tmp/nativetest/art-gtest-jars-GetMethodSignature.jar" /> + <option name="push" value="art-gtest-jars-Lookup.jar->/data/local/tmp/nativetest/art-gtest-jars-Lookup.jar" /> + <option name="push" value="art-gtest-jars-Main.jar->/data/local/tmp/nativetest/art-gtest-jars-Main.jar" /> + <option name="push" value="art-gtest-jars-MultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDex.jar" /> + <option name="push" value="art-gtest-jars-Nested.jar->/data/local/tmp/nativetest/art-gtest-jars-Nested.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_libdexfile_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/libprofile/Android.bp b/libprofile/Android.bp index fa10dfaad6..ecbcd0b8a8 100644 --- a/libprofile/Android.bp +++ b/libprofile/Android.bp @@ -184,11 +184,8 @@ art_cc_library { // For now many of these tests still use CommonRuntimeTest, almost universally because of // ScratchFile and related. // TODO: Remove CommonRuntimeTest dependency from these tests. -art_cc_test { - name: "art_libprofile_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_libprofile_tests_defaults", data: [ ":art-gtest-jars-ManyMethods", ":art-gtest-jars-MultiDex", @@ -199,9 +196,34 @@ art_cc_test { "profile/profile_compilation_info_test.cc", ], shared_libs: [ + "libziparchive", + ], +} + +// Version of ART gtest `art_libprofile_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_libprofile_tests", + defaults: [ + "art_gtest_defaults", + "art_libprofile_tests_defaults", + ], + shared_libs: [ "libartbased", "libdexfiled", - "libartbased", - "libziparchive", ], } + +// Standalone version of ART gtest `art_libprofile_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_libprofile_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_libprofile_tests_defaults", + ], + shared_libs: [ + "libartbase", + "libdexfile", + ], + test_config: "art_standalone_libprofile_tests.xml", +} diff --git a/libprofile/art_standalone_libprofile_tests.xml b/libprofile/art_standalone_libprofile_tests.xml new file mode 100644 index 0000000000..60f8a8a4b1 --- /dev/null +++ b/libprofile/art_standalone_libprofile_tests.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_libprofile_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_libprofile_tests->/data/local/tmp/nativetest/art_standalone_libprofile_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-ManyMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-ManyMethods.jar" /> + <option name="push" value="art-gtest-jars-MultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDex.jar" /> + <option name="push" value="art-gtest-jars-ProfileTestMultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-ProfileTestMultiDex.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_libprofile_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/oatdump/Android.bp b/oatdump/Android.bp index 28c0f9a9c5..a8e6dfecf5 100644 --- a/oatdump/Android.bp +++ b/oatdump/Android.bp @@ -201,11 +201,8 @@ art_cc_binary { group_static_libs: true, } -art_cc_test { - name: "art_oatdump_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_oatdump_tests_defaults", data: [ ":art-gtest-jars-ProfileTestMultiDex", ], @@ -226,3 +223,23 @@ art_cc_test { }, }, } + +// Version of ART gtest `art_oatdump_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_oatdump_tests", + defaults: [ + "art_gtest_defaults", + "art_oatdump_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_oatdump_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_oatdump_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_oatdump_tests_defaults", + ], + test_config: "art_standalone_oatdump_tests.xml", +} diff --git a/oatdump/art_standalone_oatdump_tests.xml b/oatdump/art_standalone_oatdump_tests.xml new file mode 100644 index 0000000000..64f911af4c --- /dev/null +++ b/oatdump/art_standalone_oatdump_tests.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_oatdump_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_oatdump_tests->/data/local/tmp/nativetest/art_standalone_oatdump_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-ProfileTestMultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-ProfileTestMultiDex.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_oatdump_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp index e42539dde4..c7fe647a68 100644 --- a/odrefresh/Android.bp +++ b/odrefresh/Android.bp @@ -153,11 +153,8 @@ cc_library_static { ], } -art_cc_test { - name: "art_odrefresh_tests", - defaults: [ - "art_gtest_defaults", - ], +art_cc_defaults { + name: "art_odrefresh_tests_defaults", generated_sources: ["art-odrefresh-operator-srcs"], header_libs: ["odrefresh_headers"], srcs: [ @@ -175,6 +172,25 @@ art_cc_test { shared_libs: ["libbase"], } +// Version of ART gtest `art_odrefresh_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_odrefresh_tests", + defaults: [ + "art_gtest_defaults", + "art_odrefresh_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_odrefresh_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_odrefresh_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_odrefresh_tests_defaults", + ], +} + genrule { name: "statslog_odrefresh.h", tools: ["stats-log-api-gen"], diff --git a/profman/Android.bp b/profman/Android.bp index 1b79713c60..8cc3479205 100644 --- a/profman/Android.bp +++ b/profman/Android.bp @@ -162,21 +162,46 @@ art_cc_binary { }, } +art_cc_defaults { + name: "art_profman_tests_defaults", + data: [ + ":art-gtest-jars-ProfileTestMultiDex", + ], + srcs: ["profile_assistant_test.cc"], +} + +// Version of ART gtest `art_profman_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. art_cc_test { name: "art_profman_tests", defaults: [ "art_gtest_defaults", + "art_profman_tests_defaults", ], shared_libs: [ "libprofiled", ], - data: [ - ":art-gtest-jars-ProfileTestMultiDex", - ], - srcs: ["profile_assistant_test.cc"], target: { host: { required: ["profmand"], }, }, } + +// Standalone version of ART gtest `art_profman_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_profman_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_profman_tests_defaults", + ], + shared_libs: [ + "libprofile", + ], + target: { + host: { + required: ["profman"], + }, + }, + test_config_template: "art_standalone_profman_tests.xml", +} diff --git a/profman/art_standalone_profman_tests.xml b/profman/art_standalone_profman_tests.xml new file mode 100644 index 0000000000..478e587a6a --- /dev/null +++ b/profman/art_standalone_profman_tests.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_profman_tests (as root)."> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_profman_tests->/data/local/tmp/nativetest/art_standalone_profman_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-ProfileTestMultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-ProfileTestMultiDex.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_profman_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + + <!-- The following tests from `art_standalone_profman_tests` are currently failing when + run as 32-bit on a 64-bit device, because they try to execute other system (64-bit) + processes but `LD_LIBRARY_PATH` is set to a directory of 32-bit libraries which make + them fail to dynamically link to the expected (64-bit) libraries. + + TODO(b/162834439): Investigate these failures and re-enable these tests. --> + <option name="exclude-filter" value="ProfileAssistantTest.TestProfileRoundTrip" /> + <option name="exclude-filter" value="ProfileAssistantTest.TestProfileRoundTripWithAnnotations" /> + </test> +</configuration> diff --git a/runtime/Android.bp b/runtime/Android.bp index fed89b8fdd..3bea92da71 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -629,16 +629,13 @@ art_cc_library { ], } -art_cc_library { - name: "libartd-runtime-gtest", - defaults: ["libartd-gtest-defaults"], +art_cc_defaults { + name: "libart-runtime-gtest-defaults", srcs: [ "common_runtime_test.cc", "dexopt_test.cc", ], shared_libs: [ - "libartd", - "libartbased-art-gtest", "libbase", "libbacktrace", ], @@ -647,11 +644,32 @@ art_cc_library { ], } -art_cc_test { - name: "art_runtime_tests", +art_cc_library { + name: "libart-runtime-gtest", defaults: [ - "art_gtest_defaults", + "libart-runtime-gtest-defaults", + "libart-gtest-defaults", + ], + shared_libs: [ + "libart", + "libartbase-art-gtest", + ], +} + +art_cc_library { + name: "libartd-runtime-gtest", + defaults: [ + "libart-runtime-gtest-defaults", + "libartd-gtest-defaults", + ], + shared_libs: [ + "libartd", + "libartbased-art-gtest", ], +} + +art_cc_defaults { + name: "art_runtime_tests_defaults", data: [ ":art-gtest-jars-AllFields", ":art-gtest-jars-ErroneousA", @@ -768,11 +786,6 @@ art_cc_test { "verifier/method_verifier_test.cc", "verifier/reg_type_test.cc", ], - target: { - host: { - required: ["dex2oatd"], - }, - }, shared_libs: [ "libbacktrace", ], @@ -781,28 +794,88 @@ art_cc_test { ], } +// Version of ART gtest `art_runtime_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. art_cc_test { - name: "art_runtime_compiler_tests", + name: "art_runtime_tests", defaults: [ "art_gtest_defaults", - ], - srcs: [ - "reflection_test.cc", - "module_exclusion_test.cc", + "art_runtime_tests_defaults", ], target: { host: { required: ["dex2oatd"], }, }, +} + +// Standalone version of ART gtest `art_runtime_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_runtime_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_runtime_tests_defaults", + ], + target: { + host: { + required: ["dex2oat"], + }, + }, + // Some tests are currently failing (observed on + // `aosp_cf_x86_64_phone-userdebug`); use a special test configuration for + // `art_standalone_runtime_tests` to filter them out for now. + // TODO(b/162834439): Investigate these failures and re-enable these tests. + test_config: "art_standalone_runtime_tests.xml", +} + +art_cc_defaults { + name: "art_runtime_compiler_tests_defaults", + srcs: [ + "reflection_test.cc", + "module_exclusion_test.cc", + ], data: [ ":art-gtest-jars-Main", ":art-gtest-jars-NonStaticLeafMethods", ":art-gtest-jars-StaticLeafMethods", ], +} + +// Version of ART gtest `art_runtime_compiler_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. +art_cc_test { + name: "art_runtime_compiler_tests", + defaults: [ + "art_gtest_defaults", + "art_runtime_compiler_tests_defaults", + ], shared_libs: [ "libartd-compiler", ], + target: { + host: { + required: ["dex2oatd"], + }, + }, +} + +// Standalone version of ART gtest `art_runtime_compiler_tests`, not bundled with the ART APEX on +// target. +art_cc_test { + name: "art_standalone_runtime_compiler_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_runtime_compiler_tests_defaults", + ], + shared_libs: [ + "libart-compiler", + ], + target: { + host: { + required: ["dex2oat"], + }, + }, + test_config: "art_standalone_runtime_compiler_tests.xml", } cc_library_headers { diff --git a/runtime/art_standalone_runtime_compiler_tests.xml b/runtime/art_standalone_runtime_compiler_tests.xml new file mode 100644 index 0000000000..9591cb4147 --- /dev/null +++ b/runtime/art_standalone_runtime_compiler_tests.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_runtime_compiler_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_runtime_compiler_tests->/data/local/tmp/nativetest/art_standalone_runtime_compiler_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-Main.jar->/data/local/tmp/nativetest/art-gtest-jars-Main.jar" /> + <option name="push" value="art-gtest-jars-NonStaticLeafMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-NonStaticLeafMethods.jar" /> + <option name="push" value="art-gtest-jars-StaticLeafMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-StaticLeafMethods.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_runtime_compiler_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> diff --git a/runtime/art_standalone_runtime_tests.xml b/runtime/art_standalone_runtime_tests.xml new file mode 100644 index 0000000000..ced233553c --- /dev/null +++ b/runtime/art_standalone_runtime_tests.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs art_standalone_runtime_tests."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art_standalone_runtime_tests->/data/local/tmp/nativetest/art_standalone_runtime_tests" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="art-gtest-jars-AllFields.jar->/data/local/tmp/nativetest/art-gtest-jars-AllFields.jar" /> + <option name="push" value="art-gtest-jars-ErroneousA.jar->/data/local/tmp/nativetest/art-gtest-jars-ErroneousA.jar" /> + <option name="push" value="art-gtest-jars-ErroneousB.jar->/data/local/tmp/nativetest/art-gtest-jars-ErroneousB.jar" /> + <option name="push" value="art-gtest-jars-ErroneousInit.jar->/data/local/tmp/nativetest/art-gtest-jars-ErroneousInit.jar" /> + <option name="push" value="art-gtest-jars-Extension1.jar->/data/local/tmp/nativetest/art-gtest-jars-Extension1.jar" /> + <option name="push" value="art-gtest-jars-Extension2.jar->/data/local/tmp/nativetest/art-gtest-jars-Extension2.jar" /> + <option name="push" value="art-gtest-jars-ForClassLoaderA.jar->/data/local/tmp/nativetest/art-gtest-jars-ForClassLoaderA.jar" /> + <option name="push" value="art-gtest-jars-ForClassLoaderB.jar->/data/local/tmp/nativetest/art-gtest-jars-ForClassLoaderB.jar" /> + <option name="push" value="art-gtest-jars-ForClassLoaderC.jar->/data/local/tmp/nativetest/art-gtest-jars-ForClassLoaderC.jar" /> + <option name="push" value="art-gtest-jars-ForClassLoaderD.jar->/data/local/tmp/nativetest/art-gtest-jars-ForClassLoaderD.jar" /> + <option name="push" value="art-gtest-jars-HiddenApiSignatures.jar->/data/local/tmp/nativetest/art-gtest-jars-HiddenApiSignatures.jar" /> + <option name="push" value="art-gtest-jars-IMTA.jar->/data/local/tmp/nativetest/art-gtest-jars-IMTA.jar" /> + <option name="push" value="art-gtest-jars-IMTB.jar->/data/local/tmp/nativetest/art-gtest-jars-IMTB.jar" /> + <option name="push" value="art-gtest-jars-Instrumentation.jar->/data/local/tmp/nativetest/art-gtest-jars-Instrumentation.jar" /> + <option name="push" value="art-gtest-jars-Interfaces.jar->/data/local/tmp/nativetest/art-gtest-jars-Interfaces.jar" /> + <option name="push" value="art-gtest-jars-LinkageTest.dex->/data/local/tmp/nativetest/art-gtest-jars-LinkageTest.dex" /> + <option name="push" value="art-gtest-jars-Main.jar->/data/local/tmp/nativetest/art-gtest-jars-Main.jar" /> + <option name="push" value="art-gtest-jars-MainStripped.jar->/data/local/tmp/nativetest/art-gtest-jars-MainStripped.jar" /> + <option name="push" value="art-gtest-jars-MainUncompressedAligned.jar->/data/local/tmp/nativetest/art-gtest-jars-MainUncompressedAligned.jar" /> + <option name="push" value="art-gtest-jars-MethodTypes.jar->/data/local/tmp/nativetest/art-gtest-jars-MethodTypes.jar" /> + <option name="push" value="art-gtest-jars-MultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDex.jar" /> + <option name="push" value="art-gtest-jars-MultiDexModifiedSecondary.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDexModifiedSecondary.jar" /> + <option name="push" value="art-gtest-jars-MultiDexUncompressedAligned.jar->/data/local/tmp/nativetest/art-gtest-jars-MultiDexUncompressedAligned.jar" /> + <option name="push" value="art-gtest-jars-MyClass.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClass.jar" /> + <option name="push" value="art-gtest-jars-MyClassNatives.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClassNatives.jar" /> + <option name="push" value="art-gtest-jars-Nested.jar->/data/local/tmp/nativetest/art-gtest-jars-Nested.jar" /> + <option name="push" value="art-gtest-jars-Packages.jar->/data/local/tmp/nativetest/art-gtest-jars-Packages.jar" /> + <option name="push" value="art-gtest-jars-ProfileTestMultiDex.jar->/data/local/tmp/nativetest/art-gtest-jars-ProfileTestMultiDex.jar" /> + <option name="push" value="art-gtest-jars-ProtoCompare.jar->/data/local/tmp/nativetest/art-gtest-jars-ProtoCompare.jar" /> + <option name="push" value="art-gtest-jars-ProtoCompare2.jar->/data/local/tmp/nativetest/art-gtest-jars-ProtoCompare2.jar" /> + <option name="push" value="art-gtest-jars-StaticLeafMethods.jar->/data/local/tmp/nativetest/art-gtest-jars-StaticLeafMethods.jar" /> + <option name="push" value="art-gtest-jars-Statics.jar->/data/local/tmp/nativetest/art-gtest-jars-Statics.jar" /> + <option name="push" value="art-gtest-jars-StaticsFromCode.jar->/data/local/tmp/nativetest/art-gtest-jars-StaticsFromCode.jar" /> + <option name="push" value="art-gtest-jars-Transaction.jar->/data/local/tmp/nativetest/art-gtest-jars-Transaction.jar" /> + <option name="push" value="art-gtest-jars-VerifierDeps.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDeps.dex" /> + <option name="push" value="art-gtest-jars-VerifierDepsMulti.dex->/data/local/tmp/nativetest/art-gtest-jars-VerifierDepsMulti.dex" /> + <option name="push" value="art-gtest-jars-XandY.jar->/data/local/tmp/nativetest/art-gtest-jars-XandY.jar" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="art_standalone_runtime_tests" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + + <!-- The following tests from `art_standalone_runtime_tests` are currently failing + (observed on `aosp_cf_x86_64_phone-userdebug`). + + TODO(b/162834439): Investigate these failures and re-enable these tests. --> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemDir" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemDir_MultiDex" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemFrameworkDir" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemFrameworkDir_MultiDex" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemSystemExtDir" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemSystemExtDir_MultiDex" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemSystemExtFrameworkDir" /> + <option name="exclude-filter" value="HiddenApiTest.DexDomain_SystemSystemExtFrameworkDir_MultiDex" /> + <option name="exclude-filter" value="JniInternalTest.CallVarArgMethodBadPrimitive" /> + <option name="exclude-filter" value="OatFileAssistantTest.SystemFrameworkDir" /> + <option name="exclude-filter" value="StubTest.Fields16" /> + <option name="exclude-filter" value="StubTest.Fields32" /> + <option name="exclude-filter" value="StubTest.Fields64" /> + <option name="exclude-filter" value="StubTest.Fields8" /> + <option name="exclude-filter" value="StubTest.FieldsObj" /> + <option name="exclude-filter" value="SubtypeCheckInfoTest.IllegalValues" /> + + <!-- The following tests from `art_standalone_runtime_tests` are currently failing when + run as 32-bit on a 64-bit device, because they try to execute other system (64-bit) + processes but `LD_LIBRARY_PATH` is set to a directory of 32-bit libraries which make + them fail to dynamically link to the expected (64-bit) libraries. + + TODO(b/162834439): Investigate these failures and re-enable these tests. --> + <option name="exclude-filter" value="ExecUtilsTest.EnvSnapshotDeletionsAreNotVisible" /> + <option name="exclude-filter" value="ExecUtilsTest.ExecNoTimeout" /> + <option name="exclude-filter" value="ExecUtilsTest.ExecSuccess" /> + <option name="exclude-filter" value="ExecUtilsTest.ExecTimeout" /> + </test> +</configuration> diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index 0d21de148a..b748e37917 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -132,8 +132,10 @@ void CommonRuntimeTestImpl::SetUp() { FinalizeSetup(); - // Ensure that we're really running with debug checks enabled. - CHECK(gSlowDebugTestFlag); + if (kIsDebugBuild) { + // Ensure that we're really running with debug checks enabled. + CHECK(gSlowDebugTestFlag); + } } void CommonRuntimeTestImpl::FinalizeSetup() { diff --git a/sigchainlib/Android.bp b/sigchainlib/Android.bp index b3dd7e278e..f8c8379907 100644 --- a/sigchainlib/Android.bp +++ b/sigchainlib/Android.bp @@ -81,11 +81,27 @@ cc_library_static { export_include_dirs: ["."], } +art_cc_defaults { + name: "art_sigchain_tests_defaults", + srcs: ["sigchain_test.cc"], + shared_libs: ["libsigchain"], +} + +// Version of ART gtest `art_sigchain_tests` bundled with the ART APEX on target. +// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. art_cc_test { name: "art_sigchain_tests", defaults: [ "art_gtest_defaults", + "art_sigchain_tests_defaults", + ], +} + +// Standalone version of ART gtest `art_sigchain_tests`, not bundled with the ART APEX on target. +art_cc_test { + name: "art_standalone_sigchain_tests", + defaults: [ + "art_standalone_gtest_defaults", + "art_sigchain_tests_defaults", ], - srcs: ["sigchain_test.cc"], - shared_libs: ["libsigchain"], } diff --git a/test/Android.bp b/test/Android.bp index 9eaad80738..c011057137 100644 --- a/test/Android.bp +++ b/test/Android.bp @@ -32,8 +32,24 @@ soong_config_module_type_import { ], } +// Properties common to `art_test_defaults` and `art_standalone_test_defaults`. +art_module_cc_defaults { + name: "art_test_common_defaults", + target: { + darwin: { + enabled: false, + }, + }, + cflags: [ + "-Wno-frame-larger-than=", + ], +} + art_module_cc_defaults { name: "art_test_defaults", + defaults: [ + "art_test_common_defaults", + ], host_supported: true, soong_config_variables: { source_build: { @@ -62,13 +78,7 @@ art_module_cc_defaults { android_x86_64: { relative_install_path: "art/x86_64", }, - darwin: { - enabled: false, - }, }, - cflags: [ - "-Wno-frame-larger-than=", - ], // Tests aren't generally included in any APEX, but this is necessary to // avoid duplicate install rules for them by making them unavailable to platform. apex_available: [ @@ -102,32 +112,38 @@ art_cc_defaults { }, } +// Test configuration template for standalone ART gtests on target (not bundled with the ART APEX). +filegroup { + name: "art-gtests-target-standalone-template", + srcs: [ + "art-gtests-target-standalone-template.xml", + ], +} + art_cc_defaults { - name: "art_gtest_defaults", - // These really are gtests, but the gtest library comes from `libartd-gtest.so`. - gtest: false, + name: "art_standalone_test_defaults", defaults: [ - "art_test_defaults", - "art_debug_defaults", - "art_defaults", - ], + "art_test_common_defaults", + ], + // Standalone ART gtests are only supported on device for now. + // TODO: Add support for host standalone ART gtests. Note that they should not differ much + // from the original ("non-standalone") host gtests, as the latter are not really bundled with + // the host ART APEX / artifacts (unlike their device counterparts); but as we plan to remove + // the ART gtests bundled with the ART APEX, we'll have to support the host case here + // eventually. + host_supported: false, + test_config_template: ":art-gtests-target-standalone-template", +} - test_suites: ["art-host-tests"], - test_options: { - test_suite_tag: ["art-host-gtest"], - }, +// Properties common to `art_gtest_defaults` and `art_standalone_gtest_defaults`. +art_cc_defaults { + name: "art_gtest_common_defaults", + // These really are gtests, but the gtest library comes from `libart(d)-gtest.so`. + gtest: false, shared_libs: [ - "libartd", - "libartd-disassembler", - "libartd-gtest", - "libdexfiled", - "libprofiled", - "libartbased", - "libbase", "liblog", - "libnativehelper", "libz", ], @@ -157,18 +173,113 @@ art_cc_defaults { } art_cc_defaults { - name: "libartd-gtest-defaults", - host_supported: true, + name: "art_gtest_defaults", defaults: [ + "art_test_defaults", + "art_gtest_common_defaults", "art_debug_defaults", "art_defaults", ], + + test_suites: ["art-host-tests"], + test_options: { + test_suite_tag: ["art-host-gtest"], + }, + shared_libs: [ "libartd", - "libartd-compiler", + "libartd-disassembler", + "libartd-gtest", "libdexfiled", "libprofiled", "libartbased", + + // Library `libnativehelper` needs to appear after `libartd` here, + // otherwise the following tests from module `libartd-runtime-gtest` + // will fail because `art/runtime/jni/java_vm_ext.cc` and + // `libnativehelper/JniInvocation.c` define symbols with the same name + // (e.g. `JNI_GetDefaultJavaVMInitArgs`) and the link order does matter + // for these tests: + // - JavaVmExtTest#JNI_GetDefaultJavaVMInitArgs + // - JavaVmExtTest#JNI_GetCreatedJavaVMs + // - JavaVmExtTest#AttachCurrentThread + // - JavaVmExtTest#AttachCurrentThreadAsDaemon + // - JavaVmExtTest#AttachCurrentThread_SmallStack + "libnativehelper", + ], +} + +art_cc_defaults { + name: "art_standalone_gtest_defaults", + defaults: [ + // Note: We don't include "art_debug_defaults" here, as standalone ART + // gtests link with the "non-d" versions of the libraries contained in + // the ART APEX, so that they can be used with all ART APEX flavors + // (including the Release ART APEX). + "art_standalone_test_defaults", + "art_gtest_common_defaults", + "art_defaults", + ], + + test_suites: ["general-tests"], + + // Support multilib variants (using different suffix per sub-architecture), which is needed on + // build targets with secondary architectures, as the MTS test suite packaging logic flattens + // all test artifacts into a single `testcases` directory. + compile_multilib: "both", + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, + + // We use the "non-d" variants of libraries, as the Release ART APEX does + // not contain the "d" (debug) variants. + shared_libs: [ + "libart", + "libart-disassembler", + "libdexfile", + "libprofile", + "libartbase", + + // Library `libnativehelper` needs to appear after `libart` here, + // otherwise the following tests from module `libart-runtime-gtest` + // will fail because `art/runtime/jni/java_vm_ext.cc` and + // `libnativehelper/JniInvocation.c` define symbols with the same name + // (e.g. `JNI_GetDefaultJavaVMInitArgs`) and the link order does matter + // for these tests: + // - JavaVmExtTest#JNI_GetDefaultJavaVMInitArgs + // - JavaVmExtTest#JNI_GetCreatedJavaVMs + // - JavaVmExtTest#AttachCurrentThread + // - JavaVmExtTest#AttachCurrentThreadAsDaemon + // - JavaVmExtTest#AttachCurrentThread_SmallStack + "libnativehelper", + ], + static_libs: [ + // For now, link `libart-gtest` statically for simplicity, to save the + // added complexity to package it in test suites (along with other test + // artifacts) and install it on device during tests. + // TODO(b/192070541): Consider linking `libart-gtest` dynamically. + "libart-gtest", + ], + + test_for: [ + "com.android.art", + "com.android.art.debug", + ], +} + +// Properties common to `libart-gtest-defaults` and `libartd-gtest-defaults`. +art_cc_defaults { + name: "libart-gtest-common-defaults", + defaults: [ + "art_defaults", + ], + host_supported: true, + shared_libs: [ "liblog", ], static_libs: [ @@ -202,28 +313,49 @@ art_cc_defaults { ], } -art_cc_library { - name: "libartd-gtest", - host_supported: true, +art_cc_defaults { + name: "libart-gtest-defaults", + defaults: [ + "libart-gtest-common-defaults", + ], + shared_libs: [ + "libart", + "libart-compiler", + "libdexfile", + "libprofile", + "libartbase", + ], +} + +art_cc_defaults { + name: "libartd-gtest-defaults", defaults: [ "art_debug_defaults", + "libart-gtest-common-defaults", + ], + shared_libs: [ + "libartd", + "libartd-compiler", + "libdexfiled", + "libprofiled", + "libartbased", + ], +} + +// Properties common to `libart-gtest` and `libartd-gtest`. +art_cc_defaults { + name: "libart-gtest-common", + defaults: [ "art_defaults", ], + host_supported: true, srcs: [ "common/gtest_main.cc", ], whole_static_libs: [ - "libartd-compiler-gtest", - "libartd-runtime-gtest", - "libartbased-art-gtest", "libgtest_isolated", ], shared_libs: [ - "libartd", - "libartd-compiler", - "libdexfiled", - "libprofiled", - "libartbased", "libbase", "libbacktrace", "liblog", @@ -242,6 +374,45 @@ art_cc_library { ], } +art_cc_library { + name: "libart-gtest", + defaults: [ + "libart-gtest-common", + ], + whole_static_libs: [ + "libart-compiler-gtest", + "libart-runtime-gtest", + "libartbase-art-gtest", + ], + shared_libs: [ + "libart", + "libart-compiler", + "libdexfile", + "libprofile", + "libartbase", + ], +} + +art_cc_library { + name: "libartd-gtest", + defaults: [ + "art_debug_defaults", + "libart-gtest-common", + ], + whole_static_libs: [ + "libartd-compiler-gtest", + "libartd-runtime-gtest", + "libartbased-art-gtest", + ], + shared_libs: [ + "libartd", + "libartd-compiler", + "libdexfiled", + "libprofiled", + "libartbased", + ], +} + // ART run-tests. // Test configuration template for ART run-tests on target expected to run diff --git a/test/art-gtests-target-standalone-template.xml b/test/art-gtests-target-standalone-template.xml new file mode 100644 index 0000000000..d7bad46e6d --- /dev/null +++ b/test/art-gtests-target-standalone-template.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<!-- Note: This test config file for {MODULE} is generated from a template. --> +<configuration description="Runs {MODULE}."> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="{MODULE}->/data/local/tmp/nativetest/{MODULE}" /> + <option name="append-bitness" value="true" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp/nativetest" /> + <option name="module-name" value="{MODULE}" /> + <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> + <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> + </test> +</configuration> |