Convert art gtests to Android.bp
This splits the compilation and running of the art gtests into two
separate locations. The tests are now compiled in multiple Android.bp
modules in each directory. art.go collects the installed locations of
each test and exports it as make variables. art/build/Android.gtest.mk
converts the list into the rules to run the tests.
This has a few changes in behavior:
- The rules to build tests are now always defined, and will build as
part of mmma art or make checkbuild.
- Host tests are no longer installed into out/host/linux-x86/bin, they
are in out/host/linux-x86/nativetest[64]/<module name>/<test name>
- Target tests are now in
/data/nativetest[64]/art/<arch>/<module name>/<test name>
Test: mmma -j art
Test: m -j test-art-host
Test: m -j test-art-target
Change-Id: Iabcd99d43890e6b693688422b07a283c3226a496
diff --git a/Android.bp b/Android.bp
index e8b608e..b9f1db5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,6 +20,7 @@
subdirs = [
"benchmark",
"build",
+ "cmdline",
"compiler",
"dalvikvm",
"dex2oat",
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index b5bbfef..f73f499 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -181,239 +181,25 @@
# The path for which all the source files are relative, not actually the current directory.
LOCAL_PATH := art
-RUNTIME_GTEST_COMMON_SRC_FILES := \
- cmdline/cmdline_parser_test.cc \
- dexdump/dexdump_test.cc \
- dexlayout/dexlayout_test.cc \
- dexlist/dexlist_test.cc \
- dex2oat/dex2oat_test.cc \
- imgdiag/imgdiag_test.cc \
- oatdump/oatdump_test.cc \
- profman/profile_assistant_test.cc \
- runtime/arch/arch_test.cc \
- runtime/arch/instruction_set_test.cc \
- runtime/arch/instruction_set_features_test.cc \
- runtime/arch/memcmp16_test.cc \
- runtime/arch/stub_test.cc \
- runtime/arch/arm/instruction_set_features_arm_test.cc \
- runtime/arch/arm64/instruction_set_features_arm64_test.cc \
- runtime/arch/mips/instruction_set_features_mips_test.cc \
- runtime/arch/mips64/instruction_set_features_mips64_test.cc \
- runtime/arch/x86/instruction_set_features_x86_test.cc \
- runtime/arch/x86_64/instruction_set_features_x86_64_test.cc \
- runtime/barrier_test.cc \
- runtime/base/arena_allocator_test.cc \
- runtime/base/bit_field_test.cc \
- runtime/base/bit_utils_test.cc \
- runtime/base/bit_vector_test.cc \
- runtime/base/hash_set_test.cc \
- runtime/base/hex_dump_test.cc \
- runtime/base/histogram_test.cc \
- runtime/base/mutex_test.cc \
- runtime/base/scoped_flock_test.cc \
- runtime/base/stringprintf_test.cc \
- runtime/base/time_utils_test.cc \
- runtime/base/timing_logger_test.cc \
- runtime/base/transform_array_ref_test.cc \
- runtime/base/transform_iterator_test.cc \
- runtime/base/variant_map_test.cc \
- runtime/base/unix_file/fd_file_test.cc \
- runtime/class_linker_test.cc \
- runtime/compiler_filter_test.cc \
- runtime/dex_file_test.cc \
- runtime/dex_file_verifier_test.cc \
- runtime/dex_instruction_test.cc \
- runtime/dex_instruction_visitor_test.cc \
- runtime/dex_method_iterator_test.cc \
- runtime/entrypoints/math_entrypoints_test.cc \
- runtime/entrypoints/quick/quick_trampoline_entrypoints_test.cc \
- runtime/entrypoints_order_test.cc \
- runtime/gc/accounting/card_table_test.cc \
- runtime/gc/accounting/mod_union_table_test.cc \
- runtime/gc/accounting/space_bitmap_test.cc \
- runtime/gc/collector/immune_spaces_test.cc \
- runtime/gc/heap_test.cc \
- runtime/gc/reference_queue_test.cc \
- runtime/gc/space/dlmalloc_space_static_test.cc \
- runtime/gc/space/dlmalloc_space_random_test.cc \
- runtime/gc/space/large_object_space_test.cc \
- runtime/gc/space/rosalloc_space_static_test.cc \
- runtime/gc/space/rosalloc_space_random_test.cc \
- runtime/gc/space/space_create_test.cc \
- runtime/gc/system_weak_test.cc \
- runtime/gc/task_processor_test.cc \
- runtime/gtest_test.cc \
- runtime/handle_scope_test.cc \
- runtime/indenter_test.cc \
- runtime/indirect_reference_table_test.cc \
- runtime/instrumentation_test.cc \
- runtime/intern_table_test.cc \
- runtime/interpreter/safe_math_test.cc \
- runtime/interpreter/unstarted_runtime_test.cc \
- runtime/java_vm_ext_test.cc \
- runtime/jit/profile_compilation_info_test.cc \
- runtime/leb128_test.cc \
- runtime/mem_map_test.cc \
- runtime/memory_region_test.cc \
- runtime/mirror/dex_cache_test.cc \
- runtime/mirror/object_test.cc \
- runtime/monitor_pool_test.cc \
- runtime/monitor_test.cc \
- runtime/oat_file_test.cc \
- runtime/oat_file_assistant_test.cc \
- runtime/parsed_options_test.cc \
- runtime/prebuilt_tools_test.cc \
- runtime/reference_table_test.cc \
- runtime/thread_pool_test.cc \
- runtime/transaction_test.cc \
- runtime/type_lookup_table_test.cc \
- runtime/utf_test.cc \
- runtime/utils_test.cc \
- runtime/verifier/method_verifier_test.cc \
- runtime/verifier/reg_type_test.cc \
- runtime/zip_archive_test.cc
+ART_TEST_MODULES := \
+ art_cmdline_tests \
+ art_compiler_tests \
+ art_compiler_host_tests \
+ art_dex2oat_tests \
+ art_dexdump_tests \
+ art_dexlayout_tests \
+ art_dexlist_tests \
+ art_imgdiag_tests \
+ art_oatdump_tests \
+ art_profman_tests \
+ art_runtime_tests \
+ art_runtime_compiler_tests \
-COMPILER_GTEST_COMMON_SRC_FILES := \
- runtime/jni_internal_test.cc \
- runtime/proxy_test.cc \
- runtime/reflection_test.cc \
- compiler/compiled_method_test.cc \
- compiler/debug/dwarf/dwarf_test.cc \
- compiler/driver/compiled_method_storage_test.cc \
- compiler/driver/compiler_driver_test.cc \
- compiler/elf_writer_test.cc \
- compiler/exception_test.cc \
- compiler/image_test.cc \
- compiler/jni/jni_compiler_test.cc \
- compiler/linker/multi_oat_relative_patcher_test.cc \
- compiler/linker/output_stream_test.cc \
- compiler/oat_test.cc \
- compiler/optimizing/bounds_check_elimination_test.cc \
- compiler/optimizing/dominator_test.cc \
- compiler/optimizing/find_loops_test.cc \
- compiler/optimizing/graph_checker_test.cc \
- compiler/optimizing/graph_test.cc \
- compiler/optimizing/gvn_test.cc \
- compiler/optimizing/induction_var_analysis_test.cc \
- compiler/optimizing/induction_var_range_test.cc \
- compiler/optimizing/licm_test.cc \
- compiler/optimizing/live_interval_test.cc \
- compiler/optimizing/nodes_test.cc \
- compiler/optimizing/parallel_move_test.cc \
- compiler/optimizing/pretty_printer_test.cc \
- compiler/optimizing/reference_type_propagation_test.cc \
- compiler/optimizing/side_effects_test.cc \
- compiler/optimizing/ssa_test.cc \
- compiler/optimizing/stack_map_test.cc \
- compiler/optimizing/suspend_check_test.cc \
- compiler/utils/dedupe_set_test.cc \
- compiler/utils/intrusive_forward_list_test.cc \
- compiler/utils/string_reference_test.cc \
- compiler/utils/swap_space_test.cc \
- compiler/utils/test_dex_file_builder_test.cc
+ART_TARGET_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
+ $(ART_TEST_LIST_device_$(TARGET_ARCH)_$(m)))
-COMPILER_GTEST_COMMON_SRC_FILES_all := \
- compiler/jni/jni_cfi_test.cc \
- compiler/optimizing/codegen_test.cc \
- compiler/optimizing/optimizing_cfi_test.cc \
-
-COMPILER_GTEST_COMMON_SRC_FILES_arm := \
- compiler/linker/arm/relative_patcher_thumb2_test.cc \
- compiler/utils/arm/managed_register_arm_test.cc \
-
-COMPILER_GTEST_COMMON_SRC_FILES_arm64 := \
- compiler/linker/arm64/relative_patcher_arm64_test.cc \
- compiler/utils/arm64/managed_register_arm64_test.cc \
-
-COMPILER_GTEST_COMMON_SRC_FILES_mips := \
- compiler/linker/mips/relative_patcher_mips_test.cc \
- compiler/linker/mips/relative_patcher_mips32r6_test.cc \
-
-COMPILER_GTEST_COMMON_SRC_FILES_mips64 := \
-
-COMPILER_GTEST_COMMON_SRC_FILES_x86 := \
- compiler/linker/x86/relative_patcher_x86_test.cc \
- compiler/utils/x86/managed_register_x86_test.cc \
-
-# These tests are testing architecture-independent functionality, but happen
-# to use x86 codegen as part of the test.
-COMPILER_GTEST_COMMON_SRC_FILES_x86 += \
- compiler/optimizing/constant_folding_test.cc \
- compiler/optimizing/dead_code_elimination_test.cc \
- compiler/optimizing/linearize_test.cc \
- compiler/optimizing/live_ranges_test.cc \
- compiler/optimizing/liveness_test.cc \
- compiler/optimizing/register_allocator_test.cc \
-
-COMPILER_GTEST_COMMON_SRC_FILES_x86_64 := \
- compiler/linker/x86_64/relative_patcher_x86_64_test.cc \
-
-RUNTIME_GTEST_TARGET_SRC_FILES := \
- $(RUNTIME_GTEST_COMMON_SRC_FILES)
-
-RUNTIME_GTEST_HOST_SRC_FILES := \
- $(RUNTIME_GTEST_COMMON_SRC_FILES)
-
-COMPILER_GTEST_TARGET_SRC_FILES := \
- $(COMPILER_GTEST_COMMON_SRC_FILES)
-
-COMPILER_GTEST_TARGET_SRC_FILES_all := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_all) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_arm := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_arm) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_arm64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_arm64) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_mips := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_mips) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_mips64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_mips64) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_x86 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_x86) \
-
-COMPILER_GTEST_TARGET_SRC_FILES_x86_64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_x86_64) \
-
-$(foreach arch,$(ART_TARGET_CODEGEN_ARCHS),$(eval COMPILER_GTEST_TARGET_SRC_FILES += $$(COMPILER_GTEST_TARGET_SRC_FILES_$(arch))))
-COMPILER_GTEST_TARGET_SRC_FILES += $(COMPILER_GTEST_TARGET_SRC_FILES_all)
-
-COMPILER_GTEST_HOST_SRC_FILES := \
- $(COMPILER_GTEST_COMMON_SRC_FILES) \
-
-COMPILER_GTEST_HOST_SRC_FILES_all := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_all) \
-
-COMPILER_GTEST_HOST_SRC_FILES_arm := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_arm) \
- compiler/utils/arm/assembler_thumb2_test.cc \
- compiler/utils/assembler_thumb_test.cc \
-
-COMPILER_GTEST_HOST_SRC_FILES_arm64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_arm64) \
-
-COMPILER_GTEST_HOST_SRC_FILES_mips := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_mips) \
- compiler/utils/mips/assembler_mips_test.cc \
- compiler/utils/mips/assembler_mips32r6_test.cc \
-
-COMPILER_GTEST_HOST_SRC_FILES_mips64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_mips64) \
- compiler/utils/mips64/assembler_mips64_test.cc \
-
-COMPILER_GTEST_HOST_SRC_FILES_x86 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_x86) \
- compiler/utils/x86/assembler_x86_test.cc \
-
-COMPILER_GTEST_HOST_SRC_FILES_x86_64 := \
- $(COMPILER_GTEST_COMMON_SRC_FILES_x86_64) \
- compiler/utils/x86_64/assembler_x86_64_test.cc
-
-$(foreach arch,$(ART_HOST_CODEGEN_ARCHS),$(eval COMPILER_GTEST_HOST_SRC_FILES += $$(COMPILER_GTEST_HOST_SRC_FILES_$(arch))))
-COMPILER_GTEST_HOST_SRC_FILES += $(COMPILER_GTEST_HOST_SRC_FILES_all)
+ART_HOST_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
+ $(ART_TEST_LIST_host_$(HOST_ARCH)_$(m)))
ART_TEST_CFLAGS :=
@@ -461,63 +247,70 @@
# Define a make rule for a target device gtest.
# $(1): gtest name - the name of the test we're building such as leb128_test.
-# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
-# $(3): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
+# $(2): path relative to $OUT to the test binary
+# $(3): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
+# $(4): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
define define-art-gtest-rule-target
- gtest_rule := test-art-target-gtest-$(1)$$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
+ gtest_rule := test-art-target-gtest-$(1)$$($(3)ART_PHONY_TEST_TARGET_SUFFIX)
+ gtest_exe := $(OUT_DIR)/$(2)
+ gtest_target_exe := $$(patsubst $(PRODUCT_OUT)/%,/%,$$(gtest_exe))
# Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test
# to ensure files are pushed to the device.
TEST_ART_TARGET_SYNC_DEPS += \
$$(ART_GTEST_$(1)_TARGET_DEPS) \
$(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
- $$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
- $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
- $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libopenjdkd.so \
+ $$(gtest_exe) \
+ $$($(3)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
+ $$($(3)TARGET_OUT_SHARED_LIBRARIES)/libopenjdkd.so \
$$(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar \
$$(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar \
$$(ART_TARGET_TEST_OUT)/valgrind-target-suppressions.txt
+$$(gtest_rule) valgrind-$$(gtest_rule): PRIVATE_TARGET_EXE := $$(gtest_target_exe)
+
.PHONY: $$(gtest_rule)
$$(gtest_rule): test-art-target-sync
- $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
- $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
- $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1)
+ $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
+ $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
+ $(hide) adb shell chmod 755 $$(PRIVATE_TARGET_EXE)
$(hide) $$(call ART_TEST_SKIP,$$@) && \
- (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(3) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
- $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \
- && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \
+ (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(4) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
+ $$(PRIVATE_TARGET_EXE) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID" \
+ && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID /tmp/ \
&& $$(call ART_TEST_PASSED,$$@)) \
|| $$(call ART_TEST_FAILED,$$@))
$(hide) rm -f /tmp/$$@-$$$$PPID
- ART_TEST_TARGET_GTEST$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
+ ART_TEST_TARGET_GTEST$($(3)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule)
ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule)
.PHONY: valgrind-$$(gtest_rule)
valgrind-$$(gtest_rule): $(ART_VALGRIND_TARGET_DEPENDENCIES) test-art-target-sync
- $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
- $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
- $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1)
+ $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
+ $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
+ $(hide) adb shell chmod 755 $$(PRIVATE_TARGET_EXE)
$(hide) $$(call ART_TEST_SKIP,$$@) && \
- (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(3) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
+ (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(4) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
valgrind --leak-check=full --error-exitcode=1 --workaround-gcc296-bugs=yes \
--suppressions=$(ART_TARGET_TEST_DIR)/valgrind-target-suppressions.txt \
--num-callers=50 \
- $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \
- && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \
+ $$(PRIVATE_TARGET_EXE) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID" \
+ && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID /tmp/ \
&& $$(call ART_TEST_PASSED,$$@)) \
|| $$(call ART_TEST_FAILED,$$@))
$(hide) rm -f /tmp/$$@-$$$$PPID
- ART_TEST_TARGET_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += valgrind-$$(gtest_rule)
+ ART_TEST_TARGET_VALGRIND_GTEST$$($(3)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += valgrind-$$(gtest_rule)
ART_TEST_TARGET_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
ART_TEST_TARGET_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
# Clear locally defined variables.
valgrind_gtest_rule :=
gtest_rule :=
+ gtest_exe :=
+ gtest_target_exe :=
endef # define-art-gtest-rule-target
ART_VALGRIND_DEPENDENCIES := \
@@ -532,14 +325,15 @@
# Define make rules for a host gtests.
# $(1): gtest name - the name of the test we're building such as leb128_test.
-# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
+# $(2): path relative to $OUT to the test binary
+# $(3): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
define define-art-gtest-rule-host
- gtest_rule := test-art-host-gtest-$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
- gtest_exe := $$(HOST_OUT_EXECUTABLES)/$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
+ gtest_rule := test-art-host-gtest-$(1)$$($(3)ART_PHONY_TEST_HOST_SUFFIX)
+ gtest_exe := $(OUT_DIR)/$(2)
# Dependencies for all host gtests.
gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
- $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
- $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$$(ART_HOST_SHLIB_EXTENSION) \
+ $$($(3)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
+ $$($(3)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$$(ART_HOST_SHLIB_EXTENSION) \
$$(gtest_exe) \
$$(ART_GTEST_$(1)_HOST_DEPS) \
$(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX))
@@ -551,7 +345,7 @@
$(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \
|| $$(call ART_TEST_FAILED,$$@)
- ART_TEST_HOST_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
+ ART_TEST_HOST_GTEST$$($(3)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
ART_TEST_HOST_GTEST_RULES += $$(gtest_rule)
ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule)
@@ -565,7 +359,7 @@
$$< && \
$$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
- ART_TEST_HOST_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
+ ART_TEST_HOST_VALGRIND_GTEST$$($(3)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
@@ -579,8 +373,6 @@
# Define the rules to build and run host and target gtests.
# $(1): target or host
# $(2): file name
-# $(3): extra C includes
-# $(4): extra shared libraries
define define-art-gtest
ifneq ($(1),target)
ifneq ($(1),host)
@@ -590,40 +382,11 @@
art_target_or_host := $(1)
art_gtest_filename := $(2)
- art_gtest_extra_c_includes := $(3)
- art_gtest_extra_shared_libraries := $(4)
include $$(CLEAR_VARS)
art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
- LOCAL_MODULE := $$(art_gtest_name)
+
ifeq ($$(art_target_or_host),target)
- LOCAL_MODULE_TAGS := tests
- endif
- LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
- LOCAL_SRC_FILES := $$(art_gtest_filename)
- LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime art/cmdline $$(art_gtest_extra_c_includes)
- LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest libartd-disassembler
- LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain
-
- LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
- LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
-
- # Mac OS linker doesn't understand --export-dynamic.
- ifneq ($$(HOST_OS)-$$(art_target_or_host),darwin-host)
- # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...).
- LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar
- endif
-
- LOCAL_CFLAGS := $$(ART_TEST_CFLAGS)
- ifeq ($$(art_target_or_host),target)
- $$(eval LOCAL_CLANG := $$(ART_TARGET_CLANG))
- $$(eval $$(call set-target-local-cflags-vars,debug))
- LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils libvixld-arm libvixld-arm64
- LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32)
- LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64)
- LOCAL_MULTILIB := both
- LOCAL_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
- include $$(BUILD_EXECUTABLE)
library_path :=
2nd_library_path :=
ifneq ($$(ART_TEST_ANDROID_ROOT),)
@@ -642,9 +405,9 @@
ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
ifdef TARGET_2ND_ARCH
- $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),2ND_,$$(2nd_library_path)))
+ $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),$$(art_gtest_filename),2ND_,$$(2nd_library_path)))
endif
- $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),,$$(library_path)))
+ $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),$$(art_gtest_filename),,$$(library_path)))
# A rule to run the different architecture versions of the gtest.
.PHONY: test-art-target-gtest-$$(art_gtest_name)
@@ -659,24 +422,12 @@
ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
else # host
- LOCAL_CLANG := $$(ART_HOST_CLANG)
- LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS)
- LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS) $$(ART_HOST_DEBUG_ASFLAGS)
- LOCAL_SHARED_LIBRARIES += libicuuc libicui18n libnativehelper libziparchive libz-host libvixld-arm libvixld-arm64
- LOCAL_LDLIBS := -lpthread -ldl
- LOCAL_IS_HOST_MODULE := true
- LOCAL_MULTILIB := both
- LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32
- LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64
- LOCAL_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
- include $$(BUILD_HOST_EXECUTABLE)
-
ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
ifneq ($$(HOST_PREFER_32_BIT),true)
- $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),2ND_))
+ $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),$$(art_gtest_filename),2ND_))
endif
- $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),))
+ $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),$$(art_gtest_filename),))
# Rules to run the different architecture versions of the gtest.
.PHONY: test-art-host-gtest-$$(art_gtest_name)
@@ -695,8 +446,6 @@
# Clear locally defined variables.
art_target_or_host :=
art_gtest_filename :=
- art_gtest_extra_c_includes :=
- art_gtest_extra_shared_libraries :=
art_gtest_name :=
library_path :=
2nd_library_path :=
@@ -704,19 +453,16 @@
ifeq ($(ART_BUILD_TARGET),true)
- $(foreach file,$(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),,libbacktrace)))
- $(foreach file,$(COMPILER_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),art/compiler,libartd-compiler libbacktrace libnativeloader)))
+ $(foreach file,$(ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest,target,$(file))))
endif
ifeq ($(ART_BUILD_HOST),true)
- $(foreach file,$(RUNTIME_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),,libbacktrace)))
- $(foreach file,$(COMPILER_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),art/compiler,libartd-compiler libbacktrace libnativeloader)))
+ $(foreach file,$(ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest,host,$(file))))
endif
# Used outside the art project to get a list of the current tests
RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
-$(foreach file, $(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
+$(foreach file, $(ART_TARGET_GTEST_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
COMPILER_TARGET_GTEST_MAKE_TARGETS :=
-$(foreach file, $(COMPILER_GTEST_TARGET_SRC_FILES), $(eval COMPILER_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
# Define all the combinations of host/target, valgrind and suffix such as:
# test-art-host-gtest or valgrind-test-art-host-gtest64
diff --git a/build/art.go b/build/art.go
index ffa9273..f2efbfe 100644
--- a/build/art.go
+++ b/build/art.go
@@ -19,6 +19,7 @@
"android/soong/android"
"android/soong/cc"
"fmt"
+ "sync"
"github.com/google/blueprint"
)
@@ -172,6 +173,33 @@
}
}
+func testMap(config android.Config) map[string][]string {
+ return config.Once("artTests", func() interface{} {
+ return make(map[string][]string)
+ }).(map[string][]string)
+}
+
+func testInstall(ctx android.InstallHookContext) {
+ testMap := testMap(ctx.AConfig())
+
+ var name string
+ if ctx.Host() {
+ name = "host_"
+ } else {
+ name = "device_"
+ }
+ name += ctx.Arch().ArchType.String() + "_" + ctx.ModuleName()
+
+ artTestMutex.Lock()
+ defer artTestMutex.Unlock()
+
+ tests := testMap[name]
+ tests = append(tests, ctx.Path().RelPathString())
+ testMap[name] = tests
+}
+
+var artTestMutex sync.Mutex
+
func init() {
soong.RegisterModuleType("art_cc_library", artLibrary)
soong.RegisterModuleType("art_cc_binary", artBinary)
@@ -190,7 +218,7 @@
func artDefaultsFactory() (blueprint.Module, []interface{}) {
c := &codegenProperties{}
module, props := cc.DefaultsFactory(c)
- android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c) })
+ android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, true) })
return module, props
}
@@ -199,9 +227,7 @@
library, _ := cc.NewLibrary(android.HostAndDeviceSupported, true, true)
module, props := library.Init()
- c := &codegenProperties{}
- android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c) })
- props = append(props, c)
+ props = installCodegenCustomizer(module, props, true)
return module, props
}
@@ -219,8 +245,11 @@
test := cc.NewTest(android.HostAndDeviceSupported)
module, props := test.Init()
+ props = installCodegenCustomizer(module, props, false)
+
android.AddLoadHook(module, customLinker)
android.AddLoadHook(module, prefer32Bit)
+ android.AddInstallHook(module, testInstall)
return module, props
}
diff --git a/build/codegen.go b/build/codegen.go
index d98ca4f..ba6f214 100644
--- a/build/codegen.go
+++ b/build/codegen.go
@@ -22,9 +22,11 @@
"android/soong/android"
"sort"
"strings"
+
+ "github.com/google/blueprint"
)
-func codegen(ctx android.LoadHookContext, c *codegenProperties) {
+func codegen(ctx android.LoadHookContext, c *codegenProperties, library bool) {
var hostArches, deviceArches []string
e := envDefault(ctx, "ART_HOST_CODEGEN_ARCHS", "")
@@ -41,54 +43,77 @@
deviceArches = strings.Split(e, " ")
}
- type props struct {
- Target struct {
- Android *codegenArchProperties
- Host *codegenArchProperties
+ addCodegenArchProperties := func(host bool, archName string) {
+ type props struct {
+ Target struct {
+ Android *CodegenCommonArchProperties
+ Host *CodegenCommonArchProperties
+ }
}
- }
- addCodegenArchProperties := func(p *props, hod **codegenArchProperties, arch string) {
- switch arch {
+ type libraryProps struct {
+ Target struct {
+ Android *CodegenLibraryArchProperties
+ Host *CodegenLibraryArchProperties
+ }
+ }
+
+ var arch *codegenArchProperties
+ switch archName {
case "arm":
- *hod = &c.Codegen.Arm
+ arch = &c.Codegen.Arm
case "arm64":
- *hod = &c.Codegen.Arm64
+ arch = &c.Codegen.Arm64
case "mips":
- *hod = &c.Codegen.Mips
+ arch = &c.Codegen.Mips
case "mips64":
- *hod = &c.Codegen.Mips64
+ arch = &c.Codegen.Mips64
case "x86":
- *hod = &c.Codegen.X86
+ arch = &c.Codegen.X86
case "x86_64":
- *hod = &c.Codegen.X86_64
+ arch = &c.Codegen.X86_64
default:
- ctx.ModuleErrorf("Unknown codegen architecture %q", arch)
+ ctx.ModuleErrorf("Unknown codegen architecture %q", archName)
return
}
+
+ p := &props{}
+ l := &libraryProps{}
+ if host {
+ p.Target.Host = &arch.CodegenCommonArchProperties
+ l.Target.Host = &arch.CodegenLibraryArchProperties
+ } else {
+ p.Target.Android = &arch.CodegenCommonArchProperties
+ l.Target.Android = &arch.CodegenLibraryArchProperties
+ }
+
ctx.AppendProperties(p)
+ if library {
+ ctx.AppendProperties(l)
+ }
}
- for _, a := range deviceArches {
- p := &props{}
- addCodegenArchProperties(p, &p.Target.Android, a)
+ for _, arch := range deviceArches {
+ addCodegenArchProperties(false, arch)
if ctx.Failed() {
return
}
}
- for _, a := range hostArches {
- p := &props{}
- addCodegenArchProperties(p, &p.Target.Host, a)
+ for _, arch := range hostArches {
+ addCodegenArchProperties(true, arch)
if ctx.Failed() {
return
}
}
}
-type codegenArchProperties struct {
+type CodegenCommonArchProperties struct {
Srcs []string
Cflags []string
+}
+
+type CodegenLibraryArchProperties struct {
Static struct {
Whole_static_libs []string
}
@@ -97,6 +122,11 @@
}
}
+type codegenArchProperties struct {
+ CodegenCommonArchProperties
+ CodegenLibraryArchProperties
+}
+
type codegenProperties struct {
Codegen struct {
Arm, Arm64, Mips, Mips64, X86, X86_64 codegenArchProperties
@@ -104,6 +134,7 @@
}
type codegenCustomizer struct {
+ library bool
codegenProperties codegenProperties
}
@@ -127,3 +158,11 @@
sort.Strings(ret)
return ret
}
+
+func installCodegenCustomizer(module blueprint.Module, props []interface{}, library bool) []interface{} {
+ c := &codegenProperties{}
+ android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, library) })
+ props = append(props, c)
+
+ return props
+}
diff --git a/build/makevars.go b/build/makevars.go
index 5655c55..1faa0f6 100644
--- a/build/makevars.go
+++ b/build/makevars.go
@@ -14,7 +14,12 @@
package art
-import "android/soong/android"
+import (
+ "sort"
+ "strings"
+
+ "android/soong/android"
+)
var (
pctx = android.NewPackageContext("android/soong/art")
@@ -27,4 +32,16 @@
func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("LIBART_IMG_HOST_BASE_ADDRESS", ctx.Config().LibartImgHostBaseAddress())
ctx.Strict("LIBART_IMG_TARGET_BASE_ADDRESS", ctx.Config().LibartImgDeviceBaseAddress())
+
+ testMap := testMap(ctx.Config())
+ var testNames []string
+ for name := range testMap {
+ testNames = append(testNames, name)
+ }
+
+ sort.Strings(testNames)
+
+ for _, name := range testNames {
+ ctx.Strict("ART_TEST_LIST_"+name, strings.Join(testMap[name], " "))
+ }
}
diff --git a/cmdline/Android.bp b/cmdline/Android.bp
new file mode 100644
index 0000000..c9cd9dc
--- /dev/null
+++ b/cmdline/Android.bp
@@ -0,0 +1,23 @@
+//
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+art_cc_test {
+ name: "art_cmdline_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["cmdline_parser_test.cc"],
+}
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 0581418..4af43cc 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -286,5 +286,146 @@
srcs: ["common_compiler_test.cc"],
shared_libs: [
"libartd-compiler",
+ "libart-runtime-gtest",
+ ],
+}
+
+art_cc_test {
+ name: "art_compiler_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: [
+ "compiled_method_test.cc",
+ "debug/dwarf/dwarf_test.cc",
+ "driver/compiled_method_storage_test.cc",
+ "driver/compiler_driver_test.cc",
+ "elf_writer_test.cc",
+ "exception_test.cc",
+ "image_test.cc",
+ "jni/jni_compiler_test.cc",
+ "linker/multi_oat_relative_patcher_test.cc",
+ "linker/output_stream_test.cc",
+ "oat_test.cc",
+ "optimizing/bounds_check_elimination_test.cc",
+ "optimizing/dominator_test.cc",
+ "optimizing/find_loops_test.cc",
+ "optimizing/graph_checker_test.cc",
+ "optimizing/graph_test.cc",
+ "optimizing/gvn_test.cc",
+ "optimizing/induction_var_analysis_test.cc",
+ "optimizing/induction_var_range_test.cc",
+ "optimizing/licm_test.cc",
+ "optimizing/live_interval_test.cc",
+ "optimizing/nodes_test.cc",
+ "optimizing/parallel_move_test.cc",
+ "optimizing/pretty_printer_test.cc",
+ "optimizing/reference_type_propagation_test.cc",
+ "optimizing/side_effects_test.cc",
+ "optimizing/ssa_test.cc",
+ "optimizing/stack_map_test.cc",
+ "optimizing/suspend_check_test.cc",
+ "utils/dedupe_set_test.cc",
+ "utils/intrusive_forward_list_test.cc",
+ "utils/string_reference_test.cc",
+ "utils/swap_space_test.cc",
+ "utils/test_dex_file_builder_test.cc",
+
+ "jni/jni_cfi_test.cc",
+ "optimizing/codegen_test.cc",
+ "optimizing/optimizing_cfi_test.cc",
+ ],
+
+ codegen: {
+ arm: {
+ srcs: [
+ "linker/arm/relative_patcher_thumb2_test.cc",
+ "utils/arm/managed_register_arm_test.cc",
+ ],
+ },
+ arm64: {
+ srcs: [
+ "linker/arm64/relative_patcher_arm64_test.cc",
+ "utils/arm64/managed_register_arm64_test.cc",
+ ],
+ },
+ mips: {
+ srcs: [
+ "linker/mips/relative_patcher_mips_test.cc",
+ "linker/mips/relative_patcher_mips32r6_test.cc",
+ ],
+ },
+ x86: {
+ srcs: [
+ "linker/x86/relative_patcher_x86_test.cc",
+ "utils/x86/managed_register_x86_test.cc",
+
+ // These tests are testing architecture-independent
+ // functionality, but happen to use x86 codegen as part of the
+ // test.
+ "optimizing/constant_folding_test.cc",
+ "optimizing/dead_code_elimination_test.cc",
+ "optimizing/linearize_test.cc",
+ "optimizing/live_ranges_test.cc",
+ "optimizing/liveness_test.cc",
+ "optimizing/register_allocator_test.cc",
+ ],
+ },
+ x86_64: {
+ srcs: [
+ "linker/x86_64/relative_patcher_x86_64_test.cc",
+ ],
+ },
+ },
+
+ shared_libs: [
+ "libartd-compiler",
+ "libvixld-arm",
+ "libvixld-arm64",
+
+ "libbacktrace",
+ "libnativeloader",
+ ],
+}
+
+art_cc_test {
+ name: "art_compiler_host_tests",
+ device_supported: false,
+ defaults: [
+ "art_test_defaults",
+ ],
+ codegen: {
+ arm: {
+ srcs: [
+ "utils/arm/assembler_thumb2_test.cc",
+ "utils/assembler_thumb_test.cc",
+ ],
+ },
+ mips: {
+ srcs: [
+ "utils/mips/assembler_mips_test.cc",
+ "utils/mips/assembler_mips32r6_test.cc",
+ ],
+ },
+ mips64: {
+ srcs: [
+ "utils/mips64/assembler_mips64_test.cc",
+ ],
+ },
+ x86: {
+ srcs: [
+ "utils/x86/assembler_x86_test.cc",
+ ],
+ },
+ x86_64: {
+ srcs: [
+ "utils/x86_64/assembler_x86_64_test.cc",
+ ],
+ },
+ },
+ shared_libs: [
+ "libartd-compiler",
+ "libvixld-arm",
+ "libvixld-arm64",
],
}
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index 43df6ae..d422734 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -120,3 +120,11 @@
"libvixld-arm64",
] + art_static_dependencies,
}
+
+art_cc_test {
+ name: "art_dex2oat_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["dex2oat_test.cc"],
+}
diff --git a/dexdump/Android.bp b/dexdump/Android.bp
index e77f809..74f7578 100644
--- a/dexdump/Android.bp
+++ b/dexdump/Android.bp
@@ -24,3 +24,11 @@
cflags: ["-Wall"],
shared_libs: ["libart"],
}
+
+art_cc_test {
+ name: "art_dexdump_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["dexdump_test.cc"],
+}
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index 852f6c2..9c4499f 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -23,3 +23,11 @@
cflags: ["-Wall"],
shared_libs: ["libart"],
}
+
+art_cc_test {
+ name: "art_dexlayout_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["dexlayout_test.cc"],
+}
diff --git a/dexlist/Android.bp b/dexlist/Android.bp
index 8e3c91d..ddf01db 100644
--- a/dexlist/Android.bp
+++ b/dexlist/Android.bp
@@ -19,3 +19,11 @@
cflags: ["-Wall"],
shared_libs: ["libart"],
}
+
+art_cc_test {
+ name: "art_dexlist_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["dexlist_test.cc"],
+}
diff --git a/imgdiag/Android.bp b/imgdiag/Android.bp
index 4c0772d..639b8e8 100644
--- a/imgdiag/Android.bp
+++ b/imgdiag/Android.bp
@@ -69,3 +69,11 @@
"libartd-compiler",
],
}
+
+art_cc_test {
+ name: "art_imgdiag_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["imgdiag_test.cc"],
+}
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
index b01bf51..02a51a6 100644
--- a/oatdump/Android.bp
+++ b/oatdump/Android.bp
@@ -87,3 +87,10 @@
] + art_static_dependencies,
}
+art_cc_test {
+ name: "art_oatdump_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["oatdump_test.cc"],
+}
diff --git a/profman/Android.bp b/profman/Android.bp
index f3b4e14..cd1aaab 100644
--- a/profman/Android.bp
+++ b/profman/Android.bp
@@ -52,3 +52,11 @@
"libartd",
],
}
+
+art_cc_test {
+ name: "art_profman_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: ["profile_assistant_test.cc"],
+}
diff --git a/runtime/Android.bp b/runtime/Android.bp
index e4d50ee..6acc1d8 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -471,6 +471,117 @@
],
}
+art_cc_test {
+ name: "art_runtime_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: [
+ "arch/arch_test.cc",
+ "arch/instruction_set_test.cc",
+ "arch/instruction_set_features_test.cc",
+ "arch/memcmp16_test.cc",
+ "arch/stub_test.cc",
+ "arch/arm/instruction_set_features_arm_test.cc",
+ "arch/arm64/instruction_set_features_arm64_test.cc",
+ "arch/mips/instruction_set_features_mips_test.cc",
+ "arch/mips64/instruction_set_features_mips64_test.cc",
+ "arch/x86/instruction_set_features_x86_test.cc",
+ "arch/x86_64/instruction_set_features_x86_64_test.cc",
+ "barrier_test.cc",
+ "base/arena_allocator_test.cc",
+ "base/bit_field_test.cc",
+ "base/bit_utils_test.cc",
+ "base/bit_vector_test.cc",
+ "base/hash_set_test.cc",
+ "base/hex_dump_test.cc",
+ "base/histogram_test.cc",
+ "base/mutex_test.cc",
+ "base/scoped_flock_test.cc",
+ "base/stringprintf_test.cc",
+ "base/time_utils_test.cc",
+ "base/timing_logger_test.cc",
+ "base/transform_array_ref_test.cc",
+ "base/transform_iterator_test.cc",
+ "base/variant_map_test.cc",
+ "base/unix_file/fd_file_test.cc",
+ "class_linker_test.cc",
+ "compiler_filter_test.cc",
+ "dex_file_test.cc",
+ "dex_file_verifier_test.cc",
+ "dex_instruction_test.cc",
+ "dex_instruction_visitor_test.cc",
+ "dex_method_iterator_test.cc",
+ "entrypoints/math_entrypoints_test.cc",
+ "entrypoints/quick/quick_trampoline_entrypoints_test.cc",
+ "entrypoints_order_test.cc",
+ "gc/accounting/card_table_test.cc",
+ "gc/accounting/mod_union_table_test.cc",
+ "gc/accounting/space_bitmap_test.cc",
+ "gc/collector/immune_spaces_test.cc",
+ "gc/heap_test.cc",
+ "gc/reference_queue_test.cc",
+ "gc/space/dlmalloc_space_static_test.cc",
+ "gc/space/dlmalloc_space_random_test.cc",
+ "gc/space/large_object_space_test.cc",
+ "gc/space/rosalloc_space_static_test.cc",
+ "gc/space/rosalloc_space_random_test.cc",
+ "gc/space/space_create_test.cc",
+ "gc/system_weak_test.cc",
+ "gc/task_processor_test.cc",
+ "gtest_test.cc",
+ "handle_scope_test.cc",
+ "indenter_test.cc",
+ "indirect_reference_table_test.cc",
+ "instrumentation_test.cc",
+ "intern_table_test.cc",
+ "interpreter/safe_math_test.cc",
+ "interpreter/unstarted_runtime_test.cc",
+ "java_vm_ext_test.cc",
+ "jit/profile_compilation_info_test.cc",
+ "leb128_test.cc",
+ "mem_map_test.cc",
+ "memory_region_test.cc",
+ "mirror/dex_cache_test.cc",
+ "mirror/object_test.cc",
+ "monitor_pool_test.cc",
+ "monitor_test.cc",
+ "oat_file_test.cc",
+ "oat_file_assistant_test.cc",
+ "parsed_options_test.cc",
+ "prebuilt_tools_test.cc",
+ "reference_table_test.cc",
+ "thread_pool_test.cc",
+ "transaction_test.cc",
+ "type_lookup_table_test.cc",
+ "utf_test.cc",
+ "utils_test.cc",
+ "verifier/method_verifier_test.cc",
+ "verifier/reg_type_test.cc",
+ "zip_archive_test.cc",
+ ],
+ shared_libs: [
+ "libbacktrace",
+ ],
+}
+
+art_cc_test {
+ name: "art_runtime_compiler_tests",
+ defaults: [
+ "art_test_defaults",
+ ],
+ srcs: [
+ "jni_internal_test.cc",
+ "proxy_test.cc",
+ "reflection_test.cc",
+ ],
+ shared_libs: [
+ "libartd-compiler",
+ "libvixld-arm",
+ "libvixld-arm64",
+ ],
+}
+
subdirs = [
"openjdkjvm",
"openjdkjvmti",
diff --git a/test/Android.bp b/test/Android.bp
index e2edc18..46d7c94 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -15,6 +15,103 @@
//
art_cc_defaults {
+ name: "art_test_defaults",
+ host_supported: true,
+ test_per_src: true,
+ // These really are gtests, but the gtest library comes from libart-gtest.so
+ gtest: false,
+ defaults: [
+ "art_defaults",
+ "art_debug_defaults",
+ ],
+
+ shared_libs: [
+ "libartd",
+ "libartd-disassembler",
+ "libvixld-arm",
+ "libvixld-arm64",
+ "libart-gtest",
+
+ "libicuuc",
+ "libicui18n",
+ "libnativehelper",
+ ],
+ whole_static_libs: [
+ "libsigchain",
+ ],
+ include_dirs: [
+ "art",
+ "art/cmdline",
+ ],
+
+ target: {
+ linux: {
+ ldflags: [
+ // Allow jni_compiler_test to find Java_MyClassNatives_bar
+ // within itself using dlopen(NULL, ...).
+ // Mac OS linker doesn't understand --export-dynamic.
+ "-Wl,--export-dynamic",
+ "-Wl,-u,Java_MyClassNatives_bar",
+ "-Wl,-u,Java_MyClassNatives_sbar",
+ ],
+ shared_libs: [
+ "libziparchive",
+ "libz-host",
+ ],
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ cflags: [
+ // gtest issue
+ "-Wno-used-but-marked-unused",
+ "-Wno-deprecated",
+ "-Wno-missing-noreturn",
+ ],
+ },
+ android: {
+ ldflags: [
+ // Allow jni_compiler_test to find Java_MyClassNatives_bar
+ // within itself using dlopen(NULL, ...).
+ "-Wl,--export-dynamic",
+ "-Wl,-u,Java_MyClassNatives_bar",
+ "-Wl,-u,Java_MyClassNatives_sbar",
+ ],
+ shared_libs: [
+ "libcutils",
+ "libdl",
+ "libz",
+ ],
+ cflags: [
+ // gtest issue
+ "-Wno-used-but-marked-unused",
+ "-Wno-deprecated",
+ "-Wno-missing-noreturn",
+ ],
+ },
+
+ android_arm: {
+ relative_install_path: "art/arm",
+ },
+ android_arm64: {
+ relative_install_path: "art/arm64",
+ },
+ android_mips: {
+ relative_install_path: "art/mips",
+ },
+ android_mips64: {
+ relative_install_path: "art/mips64",
+ },
+ android_x86: {
+ relative_install_path: "art/x86",
+ },
+ android_x86_64: {
+ relative_install_path: "art/x86_64",
+ },
+ },
+}
+
+art_cc_defaults {
name: "libart-gtest-defaults",
host_supported: true,
defaults: [