upload android base code part3
This commit is contained in:
parent
71b83c22f1
commit
b9e30e05b1
15122 changed files with 2089659 additions and 0 deletions
186
android/art/build/Android.bp
Normal file
186
android/art/build/Android.bp
Normal file
|
@ -0,0 +1,186 @@
|
|||
bootstrap_go_package {
|
||||
name: "soong-art",
|
||||
pkgPath: "android/soong/art",
|
||||
deps: [
|
||||
"blueprint",
|
||||
"blueprint-pathtools",
|
||||
"soong",
|
||||
"soong-android",
|
||||
"soong-cc",
|
||||
],
|
||||
srcs: [
|
||||
"art.go",
|
||||
"codegen.go",
|
||||
"makevars.go",
|
||||
],
|
||||
pluginFor: ["soong_build"],
|
||||
}
|
||||
|
||||
art_global_defaults {
|
||||
// Additional flags are computed by art.go
|
||||
|
||||
name: "art_defaults",
|
||||
clang: true,
|
||||
cflags: [
|
||||
// Base set of cflags used by all things ART.
|
||||
"-fno-rtti",
|
||||
"-ggdb3",
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wextra",
|
||||
"-Wstrict-aliasing",
|
||||
"-fstrict-aliasing",
|
||||
"-Wunreachable-code",
|
||||
"-Wredundant-decls",
|
||||
"-Wshadow",
|
||||
"-Wunused",
|
||||
"-fvisibility=protected",
|
||||
|
||||
// Warn about thread safety violations with clang.
|
||||
"-Wthread-safety",
|
||||
"-Wthread-safety-negative",
|
||||
|
||||
// Warn if switch fallthroughs aren't annotated.
|
||||
"-Wimplicit-fallthrough",
|
||||
|
||||
// Enable float equality warnings.
|
||||
"-Wfloat-equal",
|
||||
|
||||
// Enable warning of converting ints to void*.
|
||||
"-Wint-to-void-pointer-cast",
|
||||
|
||||
// Enable warning of wrong unused annotations.
|
||||
"-Wused-but-marked-unused",
|
||||
|
||||
// Enable warning for deprecated language features.
|
||||
"-Wdeprecated",
|
||||
|
||||
// Enable warning for unreachable break & return.
|
||||
"-Wunreachable-code-break",
|
||||
"-Wunreachable-code-return",
|
||||
|
||||
// Enable thread annotations for std::mutex, etc.
|
||||
"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
|
||||
],
|
||||
|
||||
target: {
|
||||
android: {
|
||||
cflags: [
|
||||
"-DART_TARGET",
|
||||
|
||||
// Enable missing-noreturn only on non-Mac. As lots of things are not implemented
|
||||
// for Apple, it's a pain.
|
||||
"-Wmissing-noreturn",
|
||||
|
||||
// To use oprofile_android --callgraph, uncomment this and recompile with
|
||||
// mmma -j art
|
||||
// "-fno-omit-frame-pointer",
|
||||
// "-marm",
|
||||
// "-mapcs",
|
||||
],
|
||||
include_dirs: [
|
||||
// We optimize Thread::Current() with a direct TLS access. This requires access to a
|
||||
// private Bionic header.
|
||||
"bionic/libc/private",
|
||||
],
|
||||
},
|
||||
linux: {
|
||||
cflags: [
|
||||
// Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
|
||||
// Apple, it's a pain.
|
||||
"-Wmissing-noreturn",
|
||||
],
|
||||
host_ldlibs: [
|
||||
"-lrt",
|
||||
],
|
||||
},
|
||||
host: {
|
||||
cflags: [
|
||||
// Bug: 15446488. We don't omit the frame pointer to work around
|
||||
// clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
|
||||
"-fno-omit-frame-pointer",
|
||||
],
|
||||
host_ldlibs: [
|
||||
"-ldl",
|
||||
"-lpthread",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
codegen: {
|
||||
arm: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_arm"],
|
||||
},
|
||||
arm64: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_arm64"],
|
||||
},
|
||||
mips: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_mips"],
|
||||
},
|
||||
mips64: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_mips64"],
|
||||
},
|
||||
x86: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_x86"],
|
||||
},
|
||||
x86_64: {
|
||||
cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
|
||||
},
|
||||
},
|
||||
|
||||
include_dirs: [
|
||||
"external/icu/icu4c/source/common",
|
||||
"external/lz4/lib",
|
||||
"external/valgrind/include",
|
||||
"external/valgrind",
|
||||
"external/vixl/src",
|
||||
"external/zlib",
|
||||
"libnativehelper/platform_include"
|
||||
],
|
||||
|
||||
tidy_checks: [
|
||||
"-google-default-arguments",
|
||||
// We have local stores that are only used for debug checks.
|
||||
"-clang-analyzer-deadcode.DeadStores",
|
||||
// We are OK with some static globals and that they can, in theory, throw.
|
||||
"-cert-err58-cpp",
|
||||
// We have lots of C-style variadic functions, and are OK with them. JNI ensures
|
||||
// that working around this warning would be extra-painful.
|
||||
"-cert-dcl50-cpp",
|
||||
// No exceptions.
|
||||
"-misc-noexcept-move-constructor",
|
||||
],
|
||||
|
||||
tidy_flags: [
|
||||
// The static analyzer treats DCHECK as always enabled; we sometimes get
|
||||
// false positives when we use DCHECKs with code that relies on NDEBUG.
|
||||
"-extra-arg=-UNDEBUG",
|
||||
// clang-tidy complains about functions like:
|
||||
// void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
|
||||
// not being marked noreturn if kIsFooEnabled is false.
|
||||
"-extra-arg=-Wno-missing-noreturn",
|
||||
],
|
||||
}
|
||||
|
||||
art_debug_defaults {
|
||||
name: "art_debug_defaults",
|
||||
cflags: [
|
||||
"-DDYNAMIC_ANNOTATIONS_ENABLED=1",
|
||||
"-DVIXL_DEBUG",
|
||||
"-UNDEBUG",
|
||||
],
|
||||
asflags: [
|
||||
"-UNDEBUG",
|
||||
],
|
||||
target: {
|
||||
// This has to be duplicated for android and host to make sure it
|
||||
// comes after the -Wframe-larger-than warnings inserted by art.go
|
||||
// target-specific properties
|
||||
android: {
|
||||
cflags: ["-Wno-frame-larger-than="],
|
||||
},
|
||||
host: {
|
||||
cflags: ["-Wno-frame-larger-than="],
|
||||
},
|
||||
},
|
||||
}
|
97
android/art/build/Android.common.mk
Normal file
97
android/art/build/Android.common.mk
Normal file
|
@ -0,0 +1,97 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
ifndef ART_ANDROID_COMMON_MK
|
||||
ART_ANDROID_COMMON_MK = true
|
||||
|
||||
ART_TARGET_SUPPORTED_ARCH := arm arm64 mips mips64 x86 x86_64
|
||||
ART_HOST_SUPPORTED_ARCH := x86 x86_64
|
||||
|
||||
ifneq ($(HOST_OS),darwin)
|
||||
ART_HOST_SUPPORTED_ARCH := x86 x86_64
|
||||
else
|
||||
# Mac OS doesn't support low-4GB allocation in a 64-bit process. So we won't be able to create
|
||||
# our heaps.
|
||||
ART_HOST_SUPPORTED_ARCH := x86
|
||||
endif
|
||||
|
||||
ART_COVERAGE := false
|
||||
|
||||
ifeq ($(ART_COVERAGE),true)
|
||||
# https://gcc.gnu.org/onlinedocs/gcc/Cross-profiling.html
|
||||
GCOV_PREFIX := /data/local/tmp/gcov
|
||||
# GCOV_PREFIX_STRIP is an integer that defines how many levels should be
|
||||
# stripped off the beginning of the path. We want the paths in $GCOV_PREFIX to
|
||||
# be relative to $ANDROID_BUILD_TOP so we can just adb pull from the top and not
|
||||
# have to worry about placing things ourselves.
|
||||
GCOV_PREFIX_STRIP := $(shell echo $(ANDROID_BUILD_TOP) | grep -o / | wc -l)
|
||||
GCOV_ENV := GCOV_PREFIX=$(GCOV_PREFIX) GCOV_PREFIX_STRIP=$(GCOV_PREFIX_STRIP)
|
||||
else
|
||||
GCOV_ENV :=
|
||||
endif
|
||||
|
||||
ifeq (,$(filter $(TARGET_ARCH),$(ART_TARGET_SUPPORTED_ARCH)))
|
||||
$(warning unsupported TARGET_ARCH=$(TARGET_ARCH))
|
||||
endif
|
||||
ifeq (,$(filter $(HOST_ARCH),$(ART_HOST_SUPPORTED_ARCH)))
|
||||
$(warning unsupported HOST_ARCH=$(HOST_ARCH))
|
||||
endif
|
||||
|
||||
# Primary vs. secondary
|
||||
2ND_TARGET_ARCH := $(TARGET_2ND_ARCH)
|
||||
TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
|
||||
2ND_TARGET_INSTRUCTION_SET_FEATURES := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
|
||||
ifdef TARGET_2ND_ARCH
|
||||
ifneq ($(filter %64,$(TARGET_ARCH)),)
|
||||
ART_PHONY_TEST_TARGET_SUFFIX := 64
|
||||
2ND_ART_PHONY_TEST_TARGET_SUFFIX := 32
|
||||
else
|
||||
# TODO: ???
|
||||
$(warning Do not know what to do with this multi-target configuration!)
|
||||
ART_PHONY_TEST_TARGET_SUFFIX := 32
|
||||
2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
|
||||
endif
|
||||
else
|
||||
ifneq ($(filter %64,$(TARGET_ARCH)),)
|
||||
ART_PHONY_TEST_TARGET_SUFFIX := 64
|
||||
2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
|
||||
else
|
||||
ART_PHONY_TEST_TARGET_SUFFIX := 32
|
||||
2ND_ART_PHONY_TEST_TARGET_SUFFIX :=
|
||||
endif
|
||||
endif
|
||||
|
||||
ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX)
|
||||
ART_HOST_SHLIB_EXTENSION ?= .so
|
||||
ifeq ($(HOST_PREFER_32_BIT),true)
|
||||
ART_PHONY_TEST_HOST_SUFFIX := 32
|
||||
2ND_ART_PHONY_TEST_HOST_SUFFIX :=
|
||||
ART_HOST_ARCH := x86
|
||||
2ND_ART_HOST_ARCH :=
|
||||
2ND_HOST_ARCH :=
|
||||
ART_HOST_OUT_SHARED_LIBRARIES := $(2ND_HOST_OUT_SHARED_LIBRARIES)
|
||||
2ND_ART_HOST_OUT_SHARED_LIBRARIES :=
|
||||
else
|
||||
ART_PHONY_TEST_HOST_SUFFIX := 64
|
||||
2ND_ART_PHONY_TEST_HOST_SUFFIX := 32
|
||||
ART_HOST_ARCH := x86_64
|
||||
2ND_ART_HOST_ARCH := x86
|
||||
2ND_HOST_ARCH := x86
|
||||
ART_HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT_SHARED_LIBRARIES)
|
||||
2ND_ART_HOST_OUT_SHARED_LIBRARIES := $(2ND_HOST_OUT_SHARED_LIBRARIES)
|
||||
endif
|
||||
|
||||
endif # ART_ANDROID_COMMON_MK
|
78
android/art/build/Android.common_build.mk
Normal file
78
android/art/build/Android.common_build.mk
Normal file
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
ifndef ART_ANDROID_COMMON_BUILD_MK
|
||||
ART_ANDROID_COMMON_BUILD_MK = true
|
||||
|
||||
include art/build/Android.common.mk
|
||||
|
||||
# These can be overridden via the environment or by editing to
|
||||
# enable/disable certain build configuration.
|
||||
#
|
||||
# For example, to disable everything but the host debug build you use:
|
||||
#
|
||||
# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
|
||||
#
|
||||
# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
|
||||
#
|
||||
ART_BUILD_TARGET_NDEBUG ?= true
|
||||
ART_BUILD_TARGET_DEBUG ?= true
|
||||
ART_BUILD_HOST_NDEBUG ?= true
|
||||
ART_BUILD_HOST_DEBUG ?= true
|
||||
|
||||
ifeq ($(ART_BUILD_TARGET_NDEBUG),false)
|
||||
$(info Disabling ART_BUILD_TARGET_NDEBUG)
|
||||
endif
|
||||
ifeq ($(ART_BUILD_TARGET_DEBUG),false)
|
||||
$(info Disabling ART_BUILD_TARGET_DEBUG)
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST_NDEBUG),false)
|
||||
$(info Disabling ART_BUILD_HOST_NDEBUG)
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST_DEBUG),false)
|
||||
$(info Disabling ART_BUILD_HOST_DEBUG)
|
||||
endif
|
||||
|
||||
# Enable the read barrier by default.
|
||||
ART_USE_READ_BARRIER ?= true
|
||||
|
||||
ART_CPP_EXTENSION := .cc
|
||||
|
||||
ifndef LIBART_IMG_HOST_BASE_ADDRESS
|
||||
$(error LIBART_IMG_HOST_BASE_ADDRESS unset)
|
||||
endif
|
||||
|
||||
ifndef LIBART_IMG_TARGET_BASE_ADDRESS
|
||||
$(error LIBART_IMG_TARGET_BASE_ADDRESS unset)
|
||||
endif
|
||||
|
||||
# Support for disabling certain builds.
|
||||
ART_BUILD_TARGET := false
|
||||
ART_BUILD_HOST := false
|
||||
ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
|
||||
ART_BUILD_TARGET := true
|
||||
endif
|
||||
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
|
||||
ART_BUILD_TARGET := true
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST_NDEBUG),true)
|
||||
ART_BUILD_HOST := true
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST_DEBUG),true)
|
||||
ART_BUILD_HOST := true
|
||||
endif
|
||||
|
||||
endif # ART_ANDROID_COMMON_BUILD_MK
|
142
android/art/build/Android.common_path.mk
Normal file
142
android/art/build/Android.common_path.mk
Normal file
|
@ -0,0 +1,142 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
ifndef ART_ANDROID_COMMON_PATH_MK
|
||||
ART_ANDROID_COMMON_PATH_MK := true
|
||||
|
||||
include art/build/Android.common.mk
|
||||
include art/build/Android.common_build.mk
|
||||
|
||||
# Directory used for dalvik-cache on device.
|
||||
ART_TARGET_DALVIK_CACHE_DIR := /data/dalvik-cache
|
||||
|
||||
# Directory used for gtests on device.
|
||||
# $(TARGET_OUT_DATA_NATIVE_TESTS) will evaluate to the nativetest directory in the target part on
|
||||
# the host, so we can strip everything but the directory to find out whether it is "nativetest" or
|
||||
# "nativetest64."
|
||||
ART_TARGET_NATIVETEST_DIR := /data/$(notdir $(TARGET_OUT_DATA_NATIVE_TESTS))/art
|
||||
|
||||
ART_TARGET_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art
|
||||
|
||||
# Directory used for oat tests on device.
|
||||
ART_TARGET_TEST_DIR := /data/art-test
|
||||
ART_TARGET_TEST_OUT := $(TARGET_OUT_DATA)/art-test
|
||||
|
||||
# core.oat location on the device.
|
||||
TARGET_CORE_OAT := $(ART_TARGET_TEST_DIR)/$(DEX2OAT_TARGET_ARCH)/core.oat
|
||||
ifdef TARGET_2ND_ARCH
|
||||
2ND_TARGET_CORE_OAT := $(ART_TARGET_TEST_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core.oat
|
||||
endif
|
||||
|
||||
CORE_OAT_SUFFIX := .oat
|
||||
|
||||
# core.oat locations under the out directory.
|
||||
HOST_CORE_OAT_OUT_BASE := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
2ND_HOST_CORE_OAT_OUT_BASE := $(HOST_OUT_JAVA_LIBRARIES)/$(2ND_ART_HOST_ARCH)/core
|
||||
endif
|
||||
HOST_CORE_OAT_OUTS :=
|
||||
TARGET_CORE_OAT_OUT_BASE := $(ART_TARGET_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core
|
||||
ifdef TARGET_2ND_ARCH
|
||||
2ND_TARGET_CORE_OAT_OUT_BASE := $(ART_TARGET_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core
|
||||
endif
|
||||
TARGET_CORE_OAT_OUTS :=
|
||||
|
||||
CORE_IMG_SUFFIX := .art
|
||||
|
||||
# core.art locations under the out directory.
|
||||
HOST_CORE_IMG_OUT_BASE := $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/core
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
2ND_HOST_CORE_IMG_OUT_BASE := $(HOST_OUT_JAVA_LIBRARIES)/$(2ND_ART_HOST_ARCH)/core
|
||||
endif
|
||||
HOST_CORE_IMG_OUTS :=
|
||||
TARGET_CORE_IMG_OUT_BASE := $(ART_TARGET_TEST_OUT)/$(DEX2OAT_TARGET_ARCH)/core
|
||||
ifdef TARGET_2ND_ARCH
|
||||
2ND_TARGET_CORE_IMG_OUT_BASE := $(ART_TARGET_TEST_OUT)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/core
|
||||
endif
|
||||
TARGET_CORE_IMG_OUTS :=
|
||||
|
||||
# Oat location of core.art.
|
||||
HOST_CORE_IMG_LOCATION := $(HOST_OUT_JAVA_LIBRARIES)/core.art
|
||||
TARGET_CORE_IMG_LOCATION := $(ART_TARGET_TEST_OUT)/core.art
|
||||
|
||||
# Jar files for core.art.
|
||||
HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
|
||||
ifeq ($(ART_TEST_ANDROID_ROOT),)
|
||||
TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
|
||||
else
|
||||
TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),$(ART_TEST_ANDROID_ROOT)/framework/$(jar).jar)
|
||||
endif
|
||||
|
||||
HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
|
||||
TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar)
|
||||
|
||||
# Classpath for Jack compilation: we only need core-libart.
|
||||
HOST_JACK_CLASSPATH_DEPENDENCIES := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj-hostdex,t,COMMON)/classes.jack $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart-hostdex,t,COMMON)/classes.jack
|
||||
HOST_JACK_CLASSPATH := $(abspath $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj-hostdex,t,COMMON)/classes.jack):$(abspath $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart-hostdex,t,COMMON)/classes.jack)
|
||||
TARGET_JACK_CLASSPATH_DEPENDENCIES := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj, ,COMMON)/classes.jack $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart, ,COMMON)/classes.jack
|
||||
TARGET_JACK_CLASSPATH := $(abspath $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj, ,COMMON)/classes.jack):$(abspath $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart, ,COMMON)/classes.jack)
|
||||
|
||||
ART_HOST_DEX_DEPENDENCIES := $(foreach jar,$(HOST_CORE_JARS),$(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
|
||||
ART_TARGET_DEX_DEPENDENCIES := $(foreach jar,$(TARGET_CORE_JARS),$(TARGET_OUT_JAVA_LIBRARIES)/$(jar).jar)
|
||||
|
||||
ART_CORE_SHARED_LIBRARIES := libjavacore libopenjdk libopenjdkjvm libopenjdkjvmti
|
||||
ART_CORE_SHARED_DEBUG_LIBRARIES := libopenjdkd libopenjdkjvmd libopenjdkjvmtid
|
||||
ART_HOST_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
|
||||
ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
|
||||
ifdef HOST_2ND_ARCH
|
||||
ART_HOST_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
endif
|
||||
|
||||
ART_TARGET_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
ifdef TARGET_2ND_ARCH
|
||||
ART_TARGET_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
|
||||
endif
|
||||
|
||||
ART_CORE_DEBUGGABLE_EXECUTABLES := \
|
||||
dex2oat \
|
||||
dexoptanalyzer \
|
||||
imgdiag \
|
||||
oatdump \
|
||||
patchoat \
|
||||
profman \
|
||||
|
||||
ART_CORE_EXECUTABLES := \
|
||||
dalvikvm \
|
||||
dexlist \
|
||||
|
||||
# Depend on the -target or -host phony targets generated by the build system
|
||||
# for each module
|
||||
ART_TARGET_EXECUTABLES :=
|
||||
ifneq ($(ART_BUILD_TARGET_NDEBUG),false)
|
||||
ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)-target)
|
||||
endif
|
||||
ifneq ($(ART_BUILD_TARGET_DEBUG),false)
|
||||
ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)d-target)
|
||||
endif
|
||||
|
||||
ART_HOST_EXECUTABLES :=
|
||||
ifneq ($(ART_BUILD_HOST_NDEBUG),false)
|
||||
ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)-host)
|
||||
endif
|
||||
ifneq ($(ART_BUILD_HOST_DEBUG),false)
|
||||
ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)d-host)
|
||||
endif
|
||||
|
||||
endif # ART_ANDROID_COMMON_PATH_MK
|
245
android/art/build/Android.common_test.mk
Normal file
245
android/art/build/Android.common_test.mk
Normal file
|
@ -0,0 +1,245 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
ifndef ART_ANDROID_COMMON_TEST_MK
|
||||
ART_ANDROID_COMMON_TEST_MK = true
|
||||
|
||||
include art/build/Android.common_path.mk
|
||||
|
||||
# Directory used for temporary test files on the host.
|
||||
ifneq ($(TMPDIR),)
|
||||
ART_HOST_TEST_DIR := $(TMPDIR)/test-art-$(shell echo $$PPID)
|
||||
else
|
||||
# Use a BSD checksum calculated from ANDROID_BUILD_TOP and USER as one of the
|
||||
# path components for the test output. This should allow us to run tests from multiple
|
||||
# repositories at the same time.
|
||||
ART_HOST_TEST_DIR := /tmp/test-art-$(shell echo ${ANDROID_BUILD_TOP}-${USER} | sum | cut -d ' ' -f1)
|
||||
endif
|
||||
|
||||
# List of known broken tests that we won't attempt to execute. The test name must be the full
|
||||
# rule name such as test-art-host-oat-optimizing-HelloWorld64.
|
||||
ART_TEST_KNOWN_BROKEN :=
|
||||
|
||||
# List of run-tests to skip running in any configuration. This needs to be the full name of the
|
||||
# run-test such as '457-regs'.
|
||||
ART_TEST_RUN_TEST_SKIP ?=
|
||||
|
||||
# Failing valgrind tests.
|
||||
# Note: *all* 64b tests involving the runtime do not work currently. b/15170219.
|
||||
|
||||
# List of known failing tests that when executed won't cause test execution to not finish.
|
||||
# The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64.
|
||||
ART_TEST_KNOWN_FAILING :=
|
||||
|
||||
# Keep going after encountering a test failure?
|
||||
ART_TEST_KEEP_GOING ?= true
|
||||
|
||||
# Do you want all tests, even those that are time consuming?
|
||||
ART_TEST_FULL ?= false
|
||||
|
||||
# Do you want run-test to be quieter? run-tests will only show output if they fail.
|
||||
ART_TEST_QUIET ?= true
|
||||
|
||||
# Do you want interpreter tests run?
|
||||
ART_TEST_INTERPRETER ?= true
|
||||
ART_TEST_INTERPRETER_ACCESS_CHECKS ?= true
|
||||
|
||||
# Do you want JIT tests run?
|
||||
ART_TEST_JIT ?= true
|
||||
|
||||
# Do you want optimizing compiler tests run?
|
||||
ART_TEST_OPTIMIZING ?= true
|
||||
|
||||
# Do you want to test the optimizing compiler with graph coloring register allocation?
|
||||
ART_TEST_OPTIMIZING_GRAPH_COLOR ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want to do run-tests with profiles?
|
||||
ART_TEST_SPEED_PROFILE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do we want to test PIC-compiled tests ("apps")?
|
||||
ART_TEST_PIC_TEST ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want tracing tests run?
|
||||
ART_TEST_TRACE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want tracing tests (streaming mode) run?
|
||||
ART_TEST_TRACE_STREAM ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want tests with GC verification enabled run?
|
||||
ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want tests with the GC stress mode enabled run?
|
||||
ART_TEST_GC_STRESS ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want tests with the JNI forcecopy mode enabled run?
|
||||
ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with relocation enabled run?
|
||||
ART_TEST_RUN_TEST_RELOCATE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with prebuilding?
|
||||
ART_TEST_RUN_TEST_PREBUILD ?= true
|
||||
|
||||
# Do you want run-tests with no prebuilding enabled run?
|
||||
ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with a pregenerated core.art?
|
||||
ART_TEST_RUN_TEST_IMAGE ?= true
|
||||
|
||||
# Do you want run-tests without a pregenerated core.art?
|
||||
ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with relocation enabled but patchoat failing?
|
||||
ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests without a dex2oat?
|
||||
ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with libartd.so?
|
||||
ART_TEST_RUN_TEST_DEBUG ?= true
|
||||
|
||||
# Do you want run-tests with libart.so?
|
||||
ART_TEST_RUN_TEST_NDEBUG ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want run-tests with the host/target's second arch?
|
||||
ART_TEST_RUN_TEST_2ND_ARCH ?= true
|
||||
|
||||
# Do you want failed tests to have their artifacts cleaned up?
|
||||
ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true
|
||||
|
||||
# Do you want run-tests with the --debuggable flag
|
||||
ART_TEST_RUN_TEST_DEBUGGABLE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Do you want to test multi-part boot-image functionality?
|
||||
ART_TEST_RUN_TEST_MULTI_IMAGE ?= $(ART_TEST_FULL)
|
||||
|
||||
# Define the command run on test failure. $(1) is the name of the test. Executed by the shell.
|
||||
# If the test was a top-level make target (e.g. `test-art-host-gtest-codegen_test64`), the command
|
||||
# fails with exit status 1 (returned by the last `grep` statement below).
|
||||
# Otherwise (e.g., if the test was run as a prerequisite of a compound test command, such as
|
||||
# `test-art-host-gtest-codegen_test`), the command does not fail, as this would break rules running
|
||||
# ART_TEST_PREREQ_FINISHED as one of their actions, which expects *all* prerequisites *not* to fail.
|
||||
define ART_TEST_FAILED
|
||||
( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \
|
||||
(mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \
|
||||
echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \
|
||||
&& (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \
|
||||
|| (echo -e "$(1) \e[91mFAILED\e[0m" >&2; echo $(MAKECMDGOALS) | grep -q -v $(1))))
|
||||
endef
|
||||
|
||||
ifeq ($(ART_TEST_QUIET),true)
|
||||
ART_TEST_ANNOUNCE_PASS := ( true )
|
||||
ART_TEST_ANNOUNCE_RUN := ( true )
|
||||
ART_TEST_ANNOUNCE_SKIP_FAILURE := ( true )
|
||||
ART_TEST_ANNOUNCE_SKIP_BROKEN := ( true )
|
||||
else
|
||||
# Note the use of '=' and not ':=' is intentional since these are actually functions.
|
||||
ART_TEST_ANNOUNCE_PASS = ( echo -e "$(1) \e[92mPASSED\e[0m" )
|
||||
ART_TEST_ANNOUNCE_RUN = ( echo -e "$(1) \e[95mRUNNING\e[0m")
|
||||
ART_TEST_ANNOUNCE_SKIP_FAILURE = ( echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m" )
|
||||
ART_TEST_ANNOUNCE_SKIP_BROKEN = ( echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m" )
|
||||
endif
|
||||
|
||||
# Define the command run on test success. $(1) is the name of the test. Executed by the shell.
|
||||
# The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g.
|
||||
# "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file
|
||||
# to be printed in the passing test summary.
|
||||
define ART_TEST_PASSED
|
||||
( $(call ART_TEST_ANNOUNCE_PASS,$(1)) && \
|
||||
(echo $(MAKECMDGOALS) | grep -q $(1) || \
|
||||
(mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1))))
|
||||
endef
|
||||
|
||||
# Define the command run on test success of multiple prerequisites. $(1) is the name of the test.
|
||||
# When the test is a top-level make target then a summary of the ran tests is produced. Executed by
|
||||
# the shell.
|
||||
define ART_TEST_PREREQ_FINISHED
|
||||
(echo -e "$(1) \e[32mCOMPLETE\e[0m" && \
|
||||
(echo $(MAKECMDGOALS) | grep -q -v $(1) || \
|
||||
(([ -d $(ART_HOST_TEST_DIR)/passed/ ] \
|
||||
&& (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \
|
||||
|| (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \
|
||||
([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \
|
||||
&& (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \
|
||||
|| (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \
|
||||
([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
|
||||
&& (echo -e "\e[91mFAILING TESTS\e[0m" >&2 && ls -1 $(ART_HOST_TEST_DIR)/failed/ >&2) \
|
||||
|| (echo -e "\e[92mNO TESTS FAILED\e[0m")) \
|
||||
&& ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \
|
||||
|| (rm -r $(ART_HOST_TEST_DIR) && false)))))
|
||||
endef
|
||||
|
||||
# Define the command executed by the shell ahead of running an art test. $(1) is the name of the
|
||||
# test.
|
||||
define ART_TEST_SKIP
|
||||
((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \
|
||||
&& ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\
|
||||
&& $(call ART_TEST_ANNOUNCE_RUN,$(1)) ) \
|
||||
|| ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \
|
||||
&& ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
|
||||
&& $(call ART_TEST_ANNOUNCE_SKIP_FAILURE,$(1)) ) \
|
||||
|| $(call ART_TEST_ANNOUNCE_SKIP_BROKEN,$(1)) ) && false))
|
||||
endef
|
||||
|
||||
# Create a build rule to create the dex file for a test.
|
||||
# $(1): module prefix, e.g. art-test-dex
|
||||
# $(2): input test directory in art/test, e.g. HelloWorld
|
||||
# $(3): target output module path (default module path is used on host)
|
||||
# $(4): additional dependencies
|
||||
# $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX
|
||||
# $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX
|
||||
#
|
||||
# If the input test directory contains a file called main.list and main.jpp,
|
||||
# then a multi-dex file is created passing main.list as the --main-dex-list
|
||||
# argument to dx and main.jpp for Jack.
|
||||
define build-art-test-dex
|
||||
ifeq ($(ART_BUILD_TARGET),true)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := $(1)-$(2)
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
|
||||
LOCAL_NO_STANDARD_LIBRARIES := true
|
||||
LOCAL_DEX_PREOPT := false
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
|
||||
LOCAL_MODULE_PATH := $(3)
|
||||
LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT)
|
||||
ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
|
||||
LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex
|
||||
LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp
|
||||
endif
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
$(5) := $$(LOCAL_INSTALLED_MODULE)
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST),true)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := $(1)-$(2)
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
|
||||
LOCAL_NO_STANDARD_LIBRARIES := true
|
||||
LOCAL_DEX_PREOPT := false
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
|
||||
LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
|
||||
LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION)
|
||||
ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
|
||||
LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex
|
||||
LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp
|
||||
endif
|
||||
include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
|
||||
$(6) := $$(LOCAL_INSTALLED_MODULE)
|
||||
endif
|
||||
endef
|
||||
|
||||
endif # ART_ANDROID_COMMON_TEST_MK
|
66
android/art/build/Android.cpplint.mk
Normal file
66
android/art/build/Android.cpplint.mk
Normal file
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright (C) 2011 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include art/build/Android.common_build.mk
|
||||
|
||||
ART_CPPLINT := $(LOCAL_PATH)/tools/cpplint.py
|
||||
ART_CPPLINT_FILTER := --filter=-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn,-runtime/printf
|
||||
ART_CPPLINT_FLAGS := --root=$(TOP)
|
||||
ART_CPPLINT_QUIET := --quiet
|
||||
ART_CPPLINT_INGORED := \
|
||||
runtime/elf.h \
|
||||
runtime/openjdkjvmti/include/jvmti.h
|
||||
|
||||
# This:
|
||||
# 1) Gets a list of all .h & .cc files in the art directory.
|
||||
# 2) Prepends 'art/' to each of them to make the full name.
|
||||
# 3) removes art/runtime/elf.h from the list.
|
||||
ART_CPPLINT_SRC := $(filter-out $(patsubst %,$(LOCAL_PATH)/%,$(ART_CPPLINT_INGORED)), $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files,*.h) $(call all-subdir-named-files,*$(ART_CPP_EXTENSION))))
|
||||
|
||||
# "mm cpplint-art" to verify we aren't regressing
|
||||
.PHONY: cpplint-art
|
||||
cpplint-art:
|
||||
$(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $(ART_CPPLINT_SRC)
|
||||
|
||||
# "mm cpplint-art-all" to see all warnings
|
||||
.PHONY: cpplint-art-all
|
||||
cpplint-art-all:
|
||||
$(ART_CPPLINT) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_SRC)
|
||||
|
||||
OUT_CPPLINT := $(TARGET_COMMON_OUT_ROOT)/cpplint
|
||||
|
||||
ART_CPPLINT_TARGETS :=
|
||||
|
||||
define declare-art-cpplint-target
|
||||
art_cpplint_file := $(1)
|
||||
art_cpplint_touch := $$(OUT_CPPLINT)/$$(subst /,__,$$(art_cpplint_file))
|
||||
|
||||
$$(art_cpplint_touch): $$(art_cpplint_file) $(ART_CPPLINT) art/build/Android.cpplint.mk
|
||||
$(hide) $(ART_CPPLINT) $(ART_CPPLINT_QUIET) $(ART_CPPLINT_FLAGS) $(ART_CPPLINT_FILTER) $$<
|
||||
$(hide) mkdir -p $$(dir $$@)
|
||||
$(hide) touch $$@
|
||||
|
||||
ART_CPPLINT_TARGETS += $$(art_cpplint_touch)
|
||||
endef
|
||||
|
||||
$(foreach file, $(ART_CPPLINT_SRC), $(eval $(call declare-art-cpplint-target,$(file))))
|
||||
#$(info $(call declare-art-cpplint-target,$(firstword $(ART_CPPLINT_SRC))))
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := cpplint-art-phony
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(ART_CPPLINT_TARGETS)
|
||||
include $(BUILD_PHONY_PACKAGE)
|
699
android/art/build/Android.gtest.mk
Normal file
699
android/art/build/Android.gtest.mk
Normal file
|
@ -0,0 +1,699 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
# The path for which all the dex files are relative, not actually the current directory.
|
||||
LOCAL_PATH := art/test
|
||||
|
||||
include art/build/Android.common_test.mk
|
||||
include art/build/Android.common_path.mk
|
||||
include art/build/Android.common_build.mk
|
||||
|
||||
# Subdirectories in art/test which contain dex files used as inputs for gtests.
|
||||
GTEST_DEX_DIRECTORIES := \
|
||||
AbstractMethod \
|
||||
AllFields \
|
||||
DefaultMethods \
|
||||
DexToDexDecompiler \
|
||||
ErroneousA \
|
||||
ErroneousB \
|
||||
ErroneousInit \
|
||||
ForClassLoaderA \
|
||||
ForClassLoaderB \
|
||||
ForClassLoaderC \
|
||||
ForClassLoaderD \
|
||||
ExceptionHandle \
|
||||
GetMethodSignature \
|
||||
ImageLayoutA \
|
||||
ImageLayoutB \
|
||||
IMTA \
|
||||
IMTB \
|
||||
Instrumentation \
|
||||
Interfaces \
|
||||
Lookup \
|
||||
Main \
|
||||
ManyMethods \
|
||||
MethodTypes \
|
||||
MultiDex \
|
||||
MultiDexModifiedSecondary \
|
||||
MyClass \
|
||||
MyClassNatives \
|
||||
Nested \
|
||||
NonStaticLeafMethods \
|
||||
Packages \
|
||||
ProtoCompare \
|
||||
ProtoCompare2 \
|
||||
ProfileTestMultiDex \
|
||||
StaticLeafMethods \
|
||||
Statics \
|
||||
StaticsFromCode \
|
||||
Transaction \
|
||||
XandY
|
||||
|
||||
# Create build rules for each dex file recording the dependency.
|
||||
$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \
|
||||
$(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \
|
||||
ART_TEST_HOST_GTEST_$(dir)_DEX)))
|
||||
|
||||
# Create rules for MainStripped, a copy of Main with the classes.dex stripped
|
||||
# for the oat file assistant tests.
|
||||
ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
|
||||
ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
|
||||
|
||||
$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
|
||||
cp $< $@
|
||||
$(call dexpreopt-remove-classes.dex,$@)
|
||||
|
||||
$(ART_TEST_TARGET_GTEST_MainStripped_DEX): $(ART_TEST_TARGET_GTEST_Main_DEX)
|
||||
cp $< $@
|
||||
$(call dexpreopt-remove-classes.dex,$@)
|
||||
|
||||
ART_TEST_GTEST_VerifierDeps_SRC := $(abspath $(wildcard $(LOCAL_PATH)/VerifierDeps/*.smali))
|
||||
ART_TEST_GTEST_VerifierDepsMulti_SRC := $(abspath $(wildcard $(LOCAL_PATH)/VerifierDepsMulti/*.smali))
|
||||
ART_TEST_HOST_GTEST_VerifierDeps_DEX := $(dir $(ART_TEST_HOST_GTEST_Main_DEX))$(subst Main,VerifierDeps,$(basename $(notdir $(ART_TEST_HOST_GTEST_Main_DEX))))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
|
||||
ART_TEST_TARGET_GTEST_VerifierDeps_DEX := $(dir $(ART_TEST_TARGET_GTEST_Main_DEX))$(subst Main,VerifierDeps,$(basename $(notdir $(ART_TEST_TARGET_GTEST_Main_DEX))))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
|
||||
ART_TEST_HOST_GTEST_VerifierDepsMulti_DEX := $(dir $(ART_TEST_HOST_GTEST_Main_DEX))$(subst Main,VerifierDepsMulti,$(basename $(notdir $(ART_TEST_HOST_GTEST_Main_DEX))))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
|
||||
ART_TEST_TARGET_GTEST_VerifierDepsMulti_DEX := $(dir $(ART_TEST_TARGET_GTEST_Main_DEX))$(subst Main,VerifierDepsMulti,$(basename $(notdir $(ART_TEST_TARGET_GTEST_Main_DEX))))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
|
||||
|
||||
$(ART_TEST_HOST_GTEST_VerifierDeps_DEX): $(ART_TEST_GTEST_VerifierDeps_SRC) $(HOST_OUT_EXECUTABLES)/smali
|
||||
$(HOST_OUT_EXECUTABLES)/smali assemble --output $@ $(filter %.smali,$^)
|
||||
|
||||
$(ART_TEST_TARGET_GTEST_VerifierDeps_DEX): $(ART_TEST_GTEST_VerifierDeps_SRC) $(HOST_OUT_EXECUTABLES)/smali
|
||||
$(HOST_OUT_EXECUTABLES)/smali assemble --output $@ $(filter %.smali,$^)
|
||||
|
||||
$(ART_TEST_HOST_GTEST_VerifierDepsMulti_DEX): $(ART_TEST_GTEST_VerifierDepsMulti_SRC) $(HOST_OUT_EXECUTABLES)/smali
|
||||
$(HOST_OUT_EXECUTABLES)/smali assemble --output $@ $(filter %.smali,$^)
|
||||
|
||||
$(ART_TEST_TARGET_GTEST_VerifierDepsMulti_DEX): $(ART_TEST_GTEST_VerifierDepsMulti_SRC) $(HOST_OUT_EXECUTABLES)/smali
|
||||
$(HOST_OUT_EXECUTABLES)/smali assemble --output $@ $(filter %.smali,$^)
|
||||
|
||||
# Dex file dependencies for each gtest.
|
||||
ART_GTEST_dex2oat_environment_tests_DEX_DEPS := Main MainStripped MultiDex MultiDexModifiedSecondary Nested
|
||||
|
||||
ART_GTEST_atomic_dex_ref_map_test_DEX_DEPS := Interfaces
|
||||
ART_GTEST_class_linker_test_DEX_DEPS := AllFields ErroneousA ErroneousB ErroneousInit ForClassLoaderA ForClassLoaderB ForClassLoaderC ForClassLoaderD Interfaces MethodTypes MultiDex MyClass Nested Statics StaticsFromCode
|
||||
ART_GTEST_class_loader_context_test_DEX_DEPS := Main MultiDex MyClass ForClassLoaderA ForClassLoaderB ForClassLoaderC ForClassLoaderD
|
||||
ART_GTEST_class_table_test_DEX_DEPS := XandY
|
||||
ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod StaticLeafMethods ProfileTestMultiDex
|
||||
ART_GTEST_dex_cache_test_DEX_DEPS := Main Packages MethodTypes
|
||||
ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature Main Nested MultiDex
|
||||
ART_GTEST_dexlayout_test_DEX_DEPS := ManyMethods
|
||||
ART_GTEST_dex2oat_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS) Statics VerifierDeps
|
||||
ART_GTEST_dex2oat_image_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS) Statics VerifierDeps
|
||||
ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle
|
||||
ART_GTEST_image_test_DEX_DEPS := ImageLayoutA ImageLayoutB DefaultMethods
|
||||
ART_GTEST_imtable_test_DEX_DEPS := IMTA IMTB
|
||||
ART_GTEST_instrumentation_test_DEX_DEPS := Instrumentation
|
||||
ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives
|
||||
ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods
|
||||
ART_GTEST_oat_file_assistant_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS)
|
||||
ART_GTEST_dexoptanalyzer_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS)
|
||||
ART_GTEST_image_space_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS)
|
||||
ART_GTEST_oat_file_test_DEX_DEPS := Main MultiDex
|
||||
ART_GTEST_oat_test_DEX_DEPS := Main
|
||||
ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
|
||||
ART_GTEST_proxy_test_DEX_DEPS := Interfaces
|
||||
ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods
|
||||
ART_GTEST_profile_assistant_test_DEX_DEPS := ProfileTestMultiDex
|
||||
ART_GTEST_profile_compilation_info_test_DEX_DEPS := ManyMethods ProfileTestMultiDex
|
||||
ART_GTEST_runtime_callbacks_test_DEX_DEPS := XandY
|
||||
ART_GTEST_stub_test_DEX_DEPS := AllFields
|
||||
ART_GTEST_transaction_test_DEX_DEPS := Transaction
|
||||
ART_GTEST_type_lookup_table_test_DEX_DEPS := Lookup
|
||||
ART_GTEST_unstarted_runtime_test_DEX_DEPS := Nested
|
||||
ART_GTEST_heap_verification_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
|
||||
ART_GTEST_verifier_deps_test_DEX_DEPS := VerifierDeps VerifierDepsMulti MultiDex
|
||||
ART_GTEST_dex_to_dex_decompiler_test_DEX_DEPS := VerifierDeps DexToDexDecompiler
|
||||
|
||||
# The elf writer test has dependencies on core.oat.
|
||||
ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_DEFAULT_64) $(HOST_CORE_IMAGE_DEFAULT_32)
|
||||
ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_DEFAULT_64) $(TARGET_CORE_IMAGE_DEFAULT_32)
|
||||
|
||||
ART_GTEST_dex2oat_environment_tests_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_optimizing_64) \
|
||||
$(HOST_CORE_IMAGE_optimizing_32) \
|
||||
$(HOST_CORE_IMAGE_interpreter_64) \
|
||||
$(HOST_CORE_IMAGE_interpreter_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/patchoatd
|
||||
ART_GTEST_dex2oat_environment_tests_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_optimizing_64) \
|
||||
$(TARGET_CORE_IMAGE_optimizing_32) \
|
||||
$(TARGET_CORE_IMAGE_interpreter_64) \
|
||||
$(TARGET_CORE_IMAGE_interpreter_32) \
|
||||
$(TARGET_OUT_EXECUTABLES)/patchoatd
|
||||
|
||||
ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
|
||||
ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
|
||||
|
||||
ART_GTEST_dexoptanalyzer_test_HOST_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_HOST_DEPS) \
|
||||
$(HOST_OUT_EXECUTABLES)/dexoptanalyzerd
|
||||
ART_GTEST_dexoptanalyzer_test_TARGET_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS) \
|
||||
dexoptanalyzerd
|
||||
|
||||
ART_GTEST_image_space_test_HOST_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
|
||||
ART_GTEST_image_space_test_TARGET_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
|
||||
|
||||
ART_GTEST_dex2oat_test_HOST_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
|
||||
ART_GTEST_dex2oat_test_TARGET_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
|
||||
|
||||
ART_GTEST_dex2oat_image_test_HOST_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
|
||||
ART_GTEST_dex2oat_image_test_TARGET_DEPS := \
|
||||
$(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
|
||||
|
||||
# TODO: document why this is needed.
|
||||
ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_DEFAULT_64) $(HOST_CORE_IMAGE_DEFAULT_32)
|
||||
|
||||
# The dexdiag test requires the dexdiag utility.
|
||||
ART_GTEST_dexdiag_test_HOST_DEPS := \
|
||||
$(HOST_OUT_EXECUTABLES)/dexdiag
|
||||
ART_GTEST_dexdiag_test_TARGET_DEPS := \
|
||||
dexdiag
|
||||
|
||||
# The dexdump test requires an image and the dexdump utility.
|
||||
# TODO: rename into dexdump when migration completes
|
||||
ART_GTEST_dexdump_test_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_64) \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/dexdump2
|
||||
ART_GTEST_dexdump_test_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_64) \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_32) \
|
||||
dexdump2
|
||||
|
||||
# The dexlayout test requires an image and the dexlayout utility.
|
||||
# TODO: rename into dexdump when migration completes
|
||||
ART_GTEST_dexlayout_test_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_64) \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/dexlayout \
|
||||
$(HOST_OUT_EXECUTABLES)/dexdump2
|
||||
ART_GTEST_dexlayout_test_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_64) \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_32) \
|
||||
dexlayout \
|
||||
dexdump2
|
||||
|
||||
# The dexlist test requires an image and the dexlist utility.
|
||||
ART_GTEST_dexlist_test_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_64) \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/dexlist
|
||||
ART_GTEST_dexlist_test_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_64) \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_32) \
|
||||
dexlist
|
||||
|
||||
# The imgdiag test has dependencies on core.oat since it needs to load it during the test.
|
||||
# For the host, also add the installed tool (in the base size, that should suffice). For the
|
||||
# target, just the module is fine, the sync will happen late enough.
|
||||
ART_GTEST_imgdiag_test_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_64) \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/imgdiagd
|
||||
ART_GTEST_imgdiag_test_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_64) \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_32) \
|
||||
imgdiagd
|
||||
|
||||
# Oatdump test requires an image and oatfile to dump.
|
||||
ART_GTEST_oatdump_test_HOST_DEPS := \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_64) \
|
||||
$(HOST_CORE_IMAGE_DEFAULT_32) \
|
||||
$(HOST_OUT_EXECUTABLES)/oatdumpd \
|
||||
$(HOST_OUT_EXECUTABLES)/oatdumpds
|
||||
ART_GTEST_oatdump_test_TARGET_DEPS := \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_64) \
|
||||
$(TARGET_CORE_IMAGE_DEFAULT_32) \
|
||||
oatdump
|
||||
ART_GTEST_oatdump_image_test_HOST_DEPS := $(ART_GTEST_oatdump_test_HOST_DEPS)
|
||||
ART_GTEST_oatdump_image_test_TARGET_DEPS := $(ART_GTEST_oatdump_test_TARGET_DEPS)
|
||||
|
||||
# Profile assistant tests requires profman utility.
|
||||
ART_GTEST_profile_assistant_test_HOST_DEPS := \
|
||||
$(HOST_OUT_EXECUTABLES)/profmand
|
||||
ART_GTEST_profile_assistant_test_TARGET_DEPS := \
|
||||
profman
|
||||
|
||||
# The path for which all the source files are relative, not actually the current directory.
|
||||
LOCAL_PATH := art
|
||||
|
||||
ART_TEST_MODULES := \
|
||||
art_cmdline_tests \
|
||||
art_compiler_tests \
|
||||
art_compiler_host_tests \
|
||||
art_dex2oat_tests \
|
||||
art_dexdiag_tests \
|
||||
art_dexdump_tests \
|
||||
art_dexlayout_tests \
|
||||
art_dexlist_tests \
|
||||
art_dexoptanalyzer_tests \
|
||||
art_imgdiag_tests \
|
||||
art_oatdump_tests \
|
||||
art_profman_tests \
|
||||
art_runtime_tests \
|
||||
art_runtime_compiler_tests \
|
||||
|
||||
ART_TARGET_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
|
||||
$(ART_TEST_LIST_device_$(TARGET_ARCH)_$(m)))
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
2ND_ART_TARGET_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
|
||||
$(ART_TEST_LIST_device_$(2ND_TARGET_ARCH)_$(m)))
|
||||
endif
|
||||
|
||||
ART_HOST_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
|
||||
$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_$(m)))
|
||||
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
2ND_ART_HOST_GTEST_FILES += $(foreach m,$(ART_TEST_MODULES),\
|
||||
$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_$(m)))
|
||||
endif
|
||||
|
||||
# Variables holding collections of gtest pre-requisits used to run a number of gtests.
|
||||
ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_GTEST_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST_RULES :=
|
||||
ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_GTEST_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST_RULES :=
|
||||
ART_TEST_HOST_GTEST_DEPENDENCIES :=
|
||||
|
||||
ART_GTEST_TARGET_ANDROID_ROOT := '/system'
|
||||
ifneq ($(ART_TEST_ANDROID_ROOT),)
|
||||
ART_GTEST_TARGET_ANDROID_ROOT := $(ART_TEST_ANDROID_ROOT)
|
||||
endif
|
||||
|
||||
ART_VALGRIND_TARGET_DEPENDENCIES := \
|
||||
$(TARGET_OUT_EXECUTABLES)/valgrind \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/memcheck-$(TARGET_ARCH)-linux \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_core-$(TARGET_ARCH)-linux.so \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_memcheck-$(TARGET_ARCH)-linux.so \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/default.supp
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
ART_VALGRIND_TARGET_DEPENDENCIES += \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/memcheck-$(TARGET_2ND_ARCH)-linux \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_core-$(TARGET_2ND_ARCH)-linux.so \
|
||||
$(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_memcheck-$(TARGET_2ND_ARCH)-linux.so
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := valgrind-target-suppressions.txt
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := test/valgrind-target-suppressions.txt
|
||||
LOCAL_MODULE_PATH := $(ART_TARGET_TEST_OUT)
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
# 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): 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)$$($(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)) \
|
||||
$$(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_$(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=$(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$($(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_$(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=$(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 --show-mismatched-frees=no \
|
||||
$$(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$$($(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 := \
|
||||
$(HOST_OUT_EXECUTABLES)/valgrind \
|
||||
$(HOST_OUT)/lib64/valgrind/memcheck-amd64-linux \
|
||||
$(HOST_OUT)/lib64/valgrind/memcheck-x86-linux \
|
||||
$(HOST_OUT)/lib64/valgrind/default.supp \
|
||||
$(HOST_OUT)/lib64/valgrind/vgpreload_core-amd64-linux.so \
|
||||
$(HOST_OUT)/lib64/valgrind/vgpreload_core-x86-linux.so \
|
||||
$(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-amd64-linux.so \
|
||||
$(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-x86-linux.so
|
||||
|
||||
# Define make rules for a host gtests.
|
||||
# $(1): gtest name - the name of the test we're building such as leb128_test.
|
||||
# $(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)$$($(3)ART_PHONY_TEST_HOST_SUFFIX)
|
||||
gtest_exe := $(OUT_DIR)/$(2)
|
||||
# Dependencies for all host gtests.
|
||||
gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
|
||||
$$($(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))
|
||||
|
||||
ART_TEST_HOST_GTEST_DEPENDENCIES += $$(gtest_deps)
|
||||
|
||||
# Note: envsetup currently exports ASAN_OPTIONS=detect_leaks=0 to suppress leak detection, as some
|
||||
# build tools (e.g., ninja) intentionally leak. We want leak checks when we run our tests, so
|
||||
# override ASAN_OPTIONS. b/37751350
|
||||
.PHONY: $$(gtest_rule)
|
||||
$$(gtest_rule): $$(gtest_exe) $$(gtest_deps)
|
||||
$(hide) ($$(call ART_TEST_SKIP,$$@) && ASAN_OPTIONS=detect_leaks=1 $$< && \
|
||||
$$(call ART_TEST_PASSED,$$@)) || $$(call ART_TEST_FAILED,$$@)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
.PHONY: valgrind-$$(gtest_rule)
|
||||
valgrind-$$(gtest_rule): $$(gtest_exe) $$(gtest_deps) $(ART_VALGRIND_DEPENDENCIES)
|
||||
$(hide) $$(call ART_TEST_SKIP,$$@) && \
|
||||
VALGRIND_LIB=$(HOST_OUT)/lib64/valgrind \
|
||||
$(HOST_OUT_EXECUTABLES)/valgrind --leak-check=full --error-exitcode=1 \
|
||||
--suppressions=art/test/valgrind-suppressions.txt --num-callers=50 \
|
||||
$$< && \
|
||||
$$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
|
||||
|
||||
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)
|
||||
|
||||
# Clear locally defined variables.
|
||||
valgrind_gtest_rule :=
|
||||
gtest_rule :=
|
||||
gtest_exe :=
|
||||
gtest_deps :=
|
||||
endef # define-art-gtest-rule-host
|
||||
|
||||
# Define the rules to build and run host and target gtests.
|
||||
# $(1): file name
|
||||
# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
|
||||
define define-art-gtest-target
|
||||
art_gtest_filename := $(1)
|
||||
|
||||
include $$(CLEAR_VARS)
|
||||
art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
|
||||
|
||||
library_path :=
|
||||
2ND_library_path :=
|
||||
ifneq ($$(ART_TEST_ANDROID_ROOT),)
|
||||
ifdef TARGET_2ND_ARCH
|
||||
2ND_library_path := $$(ART_TEST_ANDROID_ROOT)/lib
|
||||
library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
|
||||
else
|
||||
ifneq ($(filter %64,$(TARGET_ARCH)),)
|
||||
library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
|
||||
else
|
||||
library_path := $$(ART_TEST_ANDROID_ROOT)/lib
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES
|
||||
ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
|
||||
endif
|
||||
$$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),$$(art_gtest_filename),$(2),$$($(2)library_path)))
|
||||
|
||||
# Clear locally defined variables.
|
||||
art_gtest_filename :=
|
||||
art_gtest_name :=
|
||||
library_path :=
|
||||
2ND_library_path :=
|
||||
endef # define-art-gtest-target
|
||||
|
||||
# $(1): file name
|
||||
# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
|
||||
define define-art-gtest-host
|
||||
art_gtest_filename := $(1)
|
||||
|
||||
include $$(CLEAR_VARS)
|
||||
art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
|
||||
ifndef ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES
|
||||
ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
|
||||
endif
|
||||
$$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),$$(art_gtest_filename),$(2)))
|
||||
|
||||
# Clear locally defined variables.
|
||||
art_gtest_filename :=
|
||||
art_gtest_name :=
|
||||
endef # define-art-gtest-host
|
||||
|
||||
# Define the rules to build and run gtests for both archs on target.
|
||||
# $(1): test name
|
||||
define define-art-gtest-target-both
|
||||
art_gtest_name := $(1)
|
||||
|
||||
# A rule to run the different architecture versions of the gtest.
|
||||
.PHONY: test-art-target-gtest-$$(art_gtest_name)
|
||||
test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES)
|
||||
$$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
|
||||
|
||||
.PHONY: valgrind-test-art-target-gtest-$$(art_gtest_name)
|
||||
valgrind-test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
|
||||
$$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
|
||||
|
||||
# Clear now unused variables.
|
||||
ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
|
||||
art_gtest_name :=
|
||||
endef # define-art-gtest-target-both
|
||||
|
||||
# Define the rules to build and run gtests for both archs on host.
|
||||
# $(1): test name
|
||||
define define-art-gtest-host-both
|
||||
art_gtest_name := $(1)
|
||||
|
||||
.PHONY: test-art-host-gtest-$$(art_gtest_name)
|
||||
test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES)
|
||||
$$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
|
||||
|
||||
.PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name)
|
||||
valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
|
||||
$$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
|
||||
|
||||
# Clear now unused variables.
|
||||
ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
|
||||
art_gtest_name :=
|
||||
endef # define-art-gtest-host-both
|
||||
|
||||
ifeq ($(ART_BUILD_TARGET),true)
|
||||
$(foreach file,$(ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target,$(file),)))
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(foreach file,$(2ND_ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target,$(file),2ND_)))
|
||||
endif
|
||||
# Rules to run the different architecture versions of the gtest.
|
||||
$(foreach file,$(ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target-both,$$(notdir $$(basename $$(file))))))
|
||||
endif
|
||||
ifeq ($(ART_BUILD_HOST),true)
|
||||
$(foreach file,$(ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host,$(file),)))
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
$(foreach file,$(2ND_ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host,$(file),2ND_)))
|
||||
endif
|
||||
# Rules to run the different architecture versions of the gtest.
|
||||
$(foreach file,$(ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host-both,$$(notdir $$(basename $$(file))))))
|
||||
endif
|
||||
|
||||
# Used outside the art project to get a list of the current tests
|
||||
RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
|
||||
$(foreach file, $(ART_TARGET_GTEST_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
|
||||
COMPILER_TARGET_GTEST_MAKE_TARGETS :=
|
||||
|
||||
# Define all the combinations of host/target, valgrind and suffix such as:
|
||||
# test-art-host-gtest or valgrind-test-art-host-gtest64
|
||||
# $(1): host or target
|
||||
# $(2): HOST or TARGET
|
||||
# $(3): valgrind- or undefined
|
||||
# $(4): undefined, 32 or 64
|
||||
define define-test-art-gtest-combination
|
||||
ifeq ($(1),host)
|
||||
ifneq ($(2),HOST)
|
||||
$$(error argument mismatch $(1) and ($2))
|
||||
endif
|
||||
else
|
||||
ifneq ($(1),target)
|
||||
$$(error found $(1) expected host or target)
|
||||
endif
|
||||
ifneq ($(2),TARGET)
|
||||
$$(error argument mismatch $(1) and ($2))
|
||||
endif
|
||||
endif
|
||||
|
||||
rule_name := $(3)test-art-$(1)-gtest$(4)
|
||||
ifeq ($(3),valgrind-)
|
||||
dependencies := $$(ART_TEST_$(2)_VALGRIND_GTEST$(4)_RULES)
|
||||
else
|
||||
dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES)
|
||||
endif
|
||||
|
||||
.PHONY: $$(rule_name)
|
||||
$$(rule_name): $$(dependencies)
|
||||
$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
|
||||
|
||||
# Clear locally defined variables.
|
||||
rule_name :=
|
||||
dependencies :=
|
||||
endef # define-test-art-gtest-combination
|
||||
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,,))
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,))
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX)))
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,$(ART_PHONY_TEST_TARGET_SUFFIX)))
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
|
||||
$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
|
||||
endif
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,,))
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,))
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX)))
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX)))
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
|
||||
$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
|
||||
endif
|
||||
|
||||
# Clear locally defined variables.
|
||||
define-art-gtest-rule-target :=
|
||||
define-art-gtest-rule-host :=
|
||||
define-art-gtest :=
|
||||
define-test-art-gtest-combination :=
|
||||
RUNTIME_GTEST_COMMON_SRC_FILES :=
|
||||
COMPILER_GTEST_COMMON_SRC_FILES :=
|
||||
RUNTIME_GTEST_TARGET_SRC_FILES :=
|
||||
RUNTIME_GTEST_HOST_SRC_FILES :=
|
||||
COMPILER_GTEST_TARGET_SRC_FILES :=
|
||||
COMPILER_GTEST_HOST_SRC_FILES :=
|
||||
ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_GTEST_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
|
||||
ART_TEST_HOST_VALGRIND_GTEST_RULES :=
|
||||
ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_GTEST_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
|
||||
ART_TEST_TARGET_VALGRIND_GTEST_RULES :=
|
||||
ART_GTEST_TARGET_ANDROID_ROOT :=
|
||||
ART_GTEST_class_linker_test_DEX_DEPS :=
|
||||
ART_GTEST_class_table_test_DEX_DEPS :=
|
||||
ART_GTEST_compiler_driver_test_DEX_DEPS :=
|
||||
ART_GTEST_dex_file_test_DEX_DEPS :=
|
||||
ART_GTEST_exception_test_DEX_DEPS :=
|
||||
ART_GTEST_elf_writer_test_HOST_DEPS :=
|
||||
ART_GTEST_elf_writer_test_TARGET_DEPS :=
|
||||
ART_GTEST_imtable_test_DEX_DEPS :=
|
||||
ART_GTEST_jni_compiler_test_DEX_DEPS :=
|
||||
ART_GTEST_jni_internal_test_DEX_DEPS :=
|
||||
ART_GTEST_oat_file_assistant_test_DEX_DEPS :=
|
||||
ART_GTEST_oat_file_assistant_test_HOST_DEPS :=
|
||||
ART_GTEST_oat_file_assistant_test_TARGET_DEPS :=
|
||||
ART_GTEST_dexoptanalyzer_test_DEX_DEPS :=
|
||||
ART_GTEST_dexoptanalyzer_test_HOST_DEPS :=
|
||||
ART_GTEST_dexoptanalyzer_test_TARGET_DEPS :=
|
||||
ART_GTEST_image_space_test_DEX_DEPS :=
|
||||
ART_GTEST_image_space_test_HOST_DEPS :=
|
||||
ART_GTEST_image_space_test_TARGET_DEPS :=
|
||||
ART_GTEST_dex2oat_test_DEX_DEPS :=
|
||||
ART_GTEST_dex2oat_test_HOST_DEPS :=
|
||||
ART_GTEST_dex2oat_test_TARGET_DEPS :=
|
||||
ART_GTEST_dex2oat_image_test_DEX_DEPS :=
|
||||
ART_GTEST_dex2oat_image_test_HOST_DEPS :=
|
||||
ART_GTEST_dex2oat_image_test_TARGET_DEPS :=
|
||||
ART_GTEST_object_test_DEX_DEPS :=
|
||||
ART_GTEST_proxy_test_DEX_DEPS :=
|
||||
ART_GTEST_reflection_test_DEX_DEPS :=
|
||||
ART_GTEST_stub_test_DEX_DEPS :=
|
||||
ART_GTEST_transaction_test_DEX_DEPS :=
|
||||
ART_GTEST_dex2oat_environment_tests_DEX_DEPS :=
|
||||
ART_GTEST_heap_verification_test_DEX_DEPS :=
|
||||
ART_GTEST_verifier_deps_test_DEX_DEPS :=
|
||||
ART_VALGRIND_DEPENDENCIES :=
|
||||
ART_VALGRIND_TARGET_DEPENDENCIES :=
|
||||
$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=))
|
||||
$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=))
|
||||
ART_TEST_HOST_GTEST_MainStripped_DEX :=
|
||||
ART_TEST_TARGET_GTEST_MainStripped_DEX :=
|
||||
ART_TEST_GTEST_VerifierDeps_SRC :=
|
||||
ART_TEST_HOST_GTEST_VerifierDeps_DEX :=
|
||||
ART_TEST_TARGET_GTEST_VerifierDeps_DEX :=
|
||||
GTEST_DEX_DIRECTORIES :=
|
||||
LOCAL_PATH :=
|
259
android/art/build/Android.oat.mk
Normal file
259
android/art/build/Android.oat.mk
Normal file
|
@ -0,0 +1,259 @@
|
|||
#
|
||||
# Copyright (C) 2011 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.
|
||||
#
|
||||
|
||||
########################################################################
|
||||
# Rules to build a smaller "core" image to support core libraries
|
||||
# (that is, non-Android frameworks) testing on the host and target
|
||||
#
|
||||
# The main rules to build the default "boot" image are in
|
||||
# build/core/dex_preopt_libart.mk
|
||||
|
||||
include art/build/Android.common_build.mk
|
||||
|
||||
LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION :=
|
||||
ifeq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
|
||||
LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=default
|
||||
else
|
||||
LOCAL_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=$(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
|
||||
endif
|
||||
LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION :=
|
||||
ifeq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
|
||||
LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=default
|
||||
else
|
||||
LOCAL_$(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION := --instruction-set-features=$($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
|
||||
endif
|
||||
|
||||
# Use dex2oat debug version for better error reporting
|
||||
# $(1): compiler - optimizing, interpreter or interpreter-access-checks.
|
||||
# $(2): 2ND_ or undefined, 2ND_ for 32-bit host builds.
|
||||
# $(3): wrapper, e.g., valgrind.
|
||||
# $(4): dex2oat suffix, e.g, valgrind requires 32 right now.
|
||||
# $(5): multi-image.
|
||||
# NB depending on HOST_CORE_DEX_LOCATIONS so we are sure to have the dex files in frameworks for
|
||||
# run-test --no-image
|
||||
define create-core-oat-host-rules
|
||||
core_compile_options :=
|
||||
core_image_name :=
|
||||
core_oat_name :=
|
||||
core_infix :=
|
||||
core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY)
|
||||
|
||||
ifeq ($(1),optimizing)
|
||||
core_compile_options += --compiler-backend=Optimizing
|
||||
core_dex2oat_dependency := $(DEX2OAT)
|
||||
endif
|
||||
ifeq ($(1),interpreter)
|
||||
core_compile_options += --compiler-filter=quicken
|
||||
core_infix := -interpreter
|
||||
endif
|
||||
ifeq ($(1),interp-ac)
|
||||
core_compile_options += --compiler-filter=extract --runtime-arg -Xverify:softfail
|
||||
core_infix := -interp-ac
|
||||
endif
|
||||
ifneq ($(filter-out interpreter interp-ac optimizing,$(1)),)
|
||||
#Technically this test is not precise, but hopefully good enough.
|
||||
$$(error found $(1) expected interpreter, interpreter-access-checks, or optimizing)
|
||||
endif
|
||||
|
||||
# If $(5) is true, generate a multi-image.
|
||||
ifeq ($(5),true)
|
||||
core_multi_infix := -multi
|
||||
core_multi_param := --multi-image --no-inline-from=core-oj-hostdex.jar
|
||||
core_multi_group := _multi
|
||||
else
|
||||
core_multi_infix :=
|
||||
core_multi_param :=
|
||||
core_multi_group :=
|
||||
endif
|
||||
|
||||
core_image_name := $($(2)HOST_CORE_IMG_OUT_BASE)$$(core_infix)$$(core_multi_infix)$(3)$(CORE_IMG_SUFFIX)
|
||||
core_oat_name := $($(2)HOST_CORE_OAT_OUT_BASE)$$(core_infix)$$(core_multi_infix)$(3)$(CORE_OAT_SUFFIX)
|
||||
|
||||
# Using the bitness suffix makes it easier to add as a dependency for the run-test mk.
|
||||
ifeq ($(2),)
|
||||
$(3)HOST_CORE_IMAGE_$(1)$$(core_multi_group)_64 := $$(core_image_name)
|
||||
else
|
||||
$(3)HOST_CORE_IMAGE_$(1)$$(core_multi_group)_32 := $$(core_image_name)
|
||||
endif
|
||||
$(3)HOST_CORE_IMG_OUTS += $$(core_image_name)
|
||||
$(3)HOST_CORE_OAT_OUTS += $$(core_oat_name)
|
||||
|
||||
# If we have a wrapper, make the target phony.
|
||||
ifneq ($(3),)
|
||||
.PHONY: $$(core_image_name)
|
||||
endif
|
||||
$$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options)
|
||||
$$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name)
|
||||
$$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name)
|
||||
$$(core_image_name): PRIVATE_CORE_MULTI_PARAM := $$(core_multi_param)
|
||||
$$(core_image_name): $$(HOST_CORE_DEX_LOCATIONS) $$(core_dex2oat_dependency)
|
||||
@echo "host dex2oat: $$@"
|
||||
@mkdir -p $$(dir $$@)
|
||||
$$(hide) $(3) $$(DEX2OAT)$(4) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
|
||||
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
|
||||
--image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \
|
||||
$$(addprefix --dex-location=,$$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
|
||||
--oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \
|
||||
--base=$$(LIBART_IMG_HOST_BASE_ADDRESS) --instruction-set=$$($(2)ART_HOST_ARCH) \
|
||||
$$(LOCAL_$(2)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION) \
|
||||
--host --android-root=$$(HOST_OUT) \
|
||||
--generate-debug-info --generate-build-id --compile-pic \
|
||||
$$(PRIVATE_CORE_MULTI_PARAM) $$(PRIVATE_CORE_COMPILE_OPTIONS)
|
||||
|
||||
$$(core_oat_name): $$(core_image_name)
|
||||
|
||||
# Clean up locally used variables.
|
||||
core_dex2oat_dependency :=
|
||||
core_compile_options :=
|
||||
core_image_name :=
|
||||
core_oat_name :=
|
||||
core_infix :=
|
||||
endef # create-core-oat-host-rules
|
||||
|
||||
# $(1): compiler - optimizing, interpreter or interpreter-access-checks.
|
||||
# $(2): wrapper.
|
||||
# $(3): dex2oat suffix.
|
||||
# $(4): multi-image.
|
||||
define create-core-oat-host-rule-combination
|
||||
$(call create-core-oat-host-rules,$(1),,$(2),$(3),$(4))
|
||||
|
||||
ifneq ($(HOST_PREFER_32_BIT),true)
|
||||
$(call create-core-oat-host-rules,$(1),2ND_,$(2),$(3),$(4))
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call create-core-oat-host-rule-combination,optimizing,,,false))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interpreter,,,false))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interp-ac,,,false))
|
||||
$(eval $(call create-core-oat-host-rule-combination,optimizing,,,true))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interpreter,,,true))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interp-ac,,,true))
|
||||
|
||||
valgrindHOST_CORE_IMG_OUTS :=
|
||||
valgrindHOST_CORE_OAT_OUTS :=
|
||||
$(eval $(call create-core-oat-host-rule-combination,optimizing,valgrind,32,false))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interpreter,valgrind,32,false))
|
||||
$(eval $(call create-core-oat-host-rule-combination,interp-ac,valgrind,32,false))
|
||||
|
||||
valgrind-test-art-host-dex2oat-host: $(valgrindHOST_CORE_IMG_OUTS)
|
||||
|
||||
test-art-host-dex2oat-host: $(HOST_CORE_IMG_OUTS)
|
||||
|
||||
define create-core-oat-target-rules
|
||||
core_compile_options :=
|
||||
core_image_name :=
|
||||
core_oat_name :=
|
||||
core_infix :=
|
||||
core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY)
|
||||
|
||||
ifeq ($(1),optimizing)
|
||||
core_compile_options += --compiler-backend=Optimizing
|
||||
# With the optimizing compiler, we want to rerun dex2oat whenever there is
|
||||
# a dex2oat change to catch regressions early.
|
||||
core_dex2oat_dependency := $(DEX2OAT)
|
||||
endif
|
||||
ifeq ($(1),interpreter)
|
||||
core_compile_options += --compiler-filter=quicken
|
||||
core_infix := -interpreter
|
||||
endif
|
||||
ifeq ($(1),interp-ac)
|
||||
core_compile_options += --compiler-filter=extract --runtime-arg -Xverify:softfail
|
||||
core_infix := -interp-ac
|
||||
endif
|
||||
ifneq ($(filter-out interpreter interp-ac optimizing,$(1)),)
|
||||
# Technically this test is not precise, but hopefully good enough.
|
||||
$$(error found $(1) expected interpreter, interpreter-access-checks, or optimizing)
|
||||
endif
|
||||
|
||||
core_image_name := $($(2)TARGET_CORE_IMG_OUT_BASE)$$(core_infix)$(3)$(CORE_IMG_SUFFIX)
|
||||
core_oat_name := $($(2)TARGET_CORE_OAT_OUT_BASE)$$(core_infix)$(3)$(CORE_OAT_SUFFIX)
|
||||
|
||||
# Using the bitness suffix makes it easier to add as a dependency for the run-test mk.
|
||||
ifeq ($(2),)
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(3)TARGET_CORE_IMAGE_$(1)_64 := $$(core_image_name)
|
||||
else
|
||||
$(3)TARGET_CORE_IMAGE_$(1)_32 := $$(core_image_name)
|
||||
endif
|
||||
else
|
||||
$(3)TARGET_CORE_IMAGE_$(1)_32 := $$(core_image_name)
|
||||
endif
|
||||
$(3)TARGET_CORE_IMG_OUTS += $$(core_image_name)
|
||||
$(3)TARGET_CORE_OAT_OUTS += $$(core_oat_name)
|
||||
|
||||
# If we have a wrapper, make the target phony.
|
||||
ifneq ($(3),)
|
||||
.PHONY: $$(core_image_name)
|
||||
endif
|
||||
$$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options)
|
||||
$$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name)
|
||||
$$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name)
|
||||
$$(core_image_name): $$(TARGET_CORE_DEX_FILES) $$(core_dex2oat_dependency)
|
||||
@echo "target dex2oat: $$@"
|
||||
@mkdir -p $$(dir $$@)
|
||||
$$(hide) $(4) $$(DEX2OAT)$(5) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
|
||||
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
|
||||
--image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \
|
||||
$$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
|
||||
--oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \
|
||||
--base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) --instruction-set=$$($(2)TARGET_ARCH) \
|
||||
--instruction-set-variant=$$($(2)DEX2OAT_TARGET_CPU_VARIANT) \
|
||||
--instruction-set-features=$$($(2)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
|
||||
--android-root=$$(PRODUCT_OUT)/system \
|
||||
--generate-debug-info --generate-build-id --compile-pic \
|
||||
$$(PRIVATE_CORE_COMPILE_OPTIONS) || (rm $$(PRIVATE_CORE_OAT_NAME); exit 1)
|
||||
|
||||
$$(core_oat_name): $$(core_image_name)
|
||||
|
||||
# Clean up locally used variables.
|
||||
core_dex2oat_dependency :=
|
||||
core_compile_options :=
|
||||
core_image_name :=
|
||||
core_oat_name :=
|
||||
core_infix :=
|
||||
endef # create-core-oat-target-rules
|
||||
|
||||
# $(1): compiler - optimizing, interpreter or interpreter-access-checks.
|
||||
# $(2): wrapper.
|
||||
# $(3): dex2oat suffix.
|
||||
define create-core-oat-target-rule-combination
|
||||
$(call create-core-oat-target-rules,$(1),,$(2),$(3))
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(call create-core-oat-target-rules,$(1),2ND_,$(2),$(3))
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call create-core-oat-target-rule-combination,optimizing,,))
|
||||
$(eval $(call create-core-oat-target-rule-combination,interpreter,,))
|
||||
$(eval $(call create-core-oat-target-rule-combination,interp-ac,,))
|
||||
|
||||
valgrindTARGET_CORE_IMG_OUTS :=
|
||||
valgrindTARGET_CORE_OAT_OUTS :=
|
||||
$(eval $(call create-core-oat-target-rule-combination,optimizing,valgrind,32))
|
||||
$(eval $(call create-core-oat-target-rule-combination,interpreter,valgrind,32))
|
||||
$(eval $(call create-core-oat-target-rule-combination,interp-ac,valgrind,32))
|
||||
|
||||
valgrind-test-art-host-dex2oat-target: $(valgrindTARGET_CORE_IMG_OUTS)
|
||||
|
||||
valgrind-test-art-host-dex2oat: valgrind-test-art-host-dex2oat-host valgrind-test-art-host-dex2oat-target
|
||||
|
||||
# Define a default core image that can be used for things like gtests that
|
||||
# need some image to run, but don't otherwise care which image is used.
|
||||
HOST_CORE_IMAGE_DEFAULT_32 := $(HOST_CORE_IMAGE_optimizing_32)
|
||||
HOST_CORE_IMAGE_DEFAULT_64 := $(HOST_CORE_IMAGE_optimizing_64)
|
||||
TARGET_CORE_IMAGE_DEFAULT_32 := $(TARGET_CORE_IMAGE_optimizing_32)
|
||||
TARGET_CORE_IMAGE_DEFAULT_64 := $(TARGET_CORE_IMAGE_optimizing_64)
|
344
android/art/build/art.go
Normal file
344
android/art/build/art.go
Normal file
|
@ -0,0 +1,344 @@
|
|||
// Copyright (C) 2016 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package art
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"android/soong/cc"
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var supportedArches = []string{"arm", "arm64", "mips", "mips64", "x86", "x86_64"}
|
||||
|
||||
func globalFlags(ctx android.BaseContext) ([]string, []string) {
|
||||
var cflags []string
|
||||
var asflags []string
|
||||
|
||||
opt := envDefault(ctx, "ART_NDEBUG_OPT_FLAG", "-O3")
|
||||
cflags = append(cflags, opt)
|
||||
|
||||
tlab := false
|
||||
|
||||
gcType := envDefault(ctx, "ART_DEFAULT_GC_TYPE", "CMS")
|
||||
|
||||
if envTrue(ctx, "ART_TEST_DEBUG_GC") {
|
||||
gcType = "SS"
|
||||
tlab = true
|
||||
}
|
||||
|
||||
cflags = append(cflags, "-DART_DEFAULT_GC_TYPE_IS_"+gcType)
|
||||
if tlab {
|
||||
cflags = append(cflags, "-DART_USE_TLAB=1")
|
||||
}
|
||||
|
||||
if !envFalse(ctx, "ART_ENABLE_VDEX") {
|
||||
cflags = append(cflags, "-DART_ENABLE_VDEX")
|
||||
}
|
||||
|
||||
imtSize := envDefault(ctx, "ART_IMT_SIZE", "43")
|
||||
cflags = append(cflags, "-DIMT_SIZE="+imtSize)
|
||||
|
||||
if envTrue(ctx, "ART_HEAP_POISONING") {
|
||||
cflags = append(cflags, "-DART_HEAP_POISONING=1")
|
||||
asflags = append(asflags, "-DART_HEAP_POISONING=1")
|
||||
}
|
||||
|
||||
if !envFalse(ctx, "ART_USE_READ_BARRIER") && ctx.AConfig().ArtUseReadBarrier() {
|
||||
// Used to change the read barrier type. Valid values are BAKER, BROOKS,
|
||||
// TABLELOOKUP. The default is BAKER.
|
||||
barrierType := envDefault(ctx, "ART_READ_BARRIER_TYPE", "BAKER")
|
||||
cflags = append(cflags,
|
||||
"-DART_USE_READ_BARRIER=1",
|
||||
"-DART_READ_BARRIER_TYPE_IS_"+barrierType+"=1")
|
||||
asflags = append(asflags,
|
||||
"-DART_USE_READ_BARRIER=1",
|
||||
"-DART_READ_BARRIER_TYPE_IS_"+barrierType+"=1")
|
||||
}
|
||||
|
||||
// We need larger stack overflow guards for ASAN, as the compiled code will have
|
||||
// larger frame sizes. For simplicity, just use global not-target-specific cflags.
|
||||
// Note: We increase this for both debug and non-debug, as the overflow gap will
|
||||
// be compiled into managed code. We always preopt (and build core images) with
|
||||
// the debug version. So make the gap consistent (and adjust for the worst).
|
||||
if len(ctx.AConfig().SanitizeDevice()) > 0 || len(ctx.AConfig().SanitizeHost()) > 0 {
|
||||
cflags = append(cflags,
|
||||
"-DART_STACK_OVERFLOW_GAP_arm=8192",
|
||||
"-DART_STACK_OVERFLOW_GAP_arm64=8192",
|
||||
"-DART_STACK_OVERFLOW_GAP_mips=16384",
|
||||
"-DART_STACK_OVERFLOW_GAP_mips64=16384",
|
||||
"-DART_STACK_OVERFLOW_GAP_x86=16384",
|
||||
"-DART_STACK_OVERFLOW_GAP_x86_64=20480")
|
||||
} else {
|
||||
cflags = append(cflags,
|
||||
"-DART_STACK_OVERFLOW_GAP_arm=8192",
|
||||
"-DART_STACK_OVERFLOW_GAP_arm64=8192",
|
||||
"-DART_STACK_OVERFLOW_GAP_mips=16384",
|
||||
"-DART_STACK_OVERFLOW_GAP_mips64=16384",
|
||||
"-DART_STACK_OVERFLOW_GAP_x86=8192",
|
||||
"-DART_STACK_OVERFLOW_GAP_x86_64=8192")
|
||||
}
|
||||
|
||||
if envTrue(ctx, "ART_ENABLE_ADDRESS_SANITIZER") {
|
||||
// Used to enable full sanitization, i.e., user poisoning, under ASAN.
|
||||
cflags = append(cflags, "-DART_ENABLE_ADDRESS_SANITIZER=1")
|
||||
asflags = append(asflags, "-DART_ENABLE_ADDRESS_SANITIZER=1")
|
||||
}
|
||||
|
||||
return cflags, asflags
|
||||
}
|
||||
|
||||
func debugFlags(ctx android.BaseContext) []string {
|
||||
var cflags []string
|
||||
|
||||
opt := envDefault(ctx, "ART_DEBUG_OPT_FLAG", "-O2")
|
||||
cflags = append(cflags, opt)
|
||||
|
||||
return cflags
|
||||
}
|
||||
|
||||
func deviceFlags(ctx android.BaseContext) []string {
|
||||
var cflags []string
|
||||
deviceFrameSizeLimit := 1736
|
||||
if len(ctx.AConfig().SanitizeDevice()) > 0 {
|
||||
deviceFrameSizeLimit = 7400
|
||||
}
|
||||
cflags = append(cflags,
|
||||
fmt.Sprintf("-Wframe-larger-than=%d", deviceFrameSizeLimit),
|
||||
fmt.Sprintf("-DART_FRAME_SIZE_LIMIT=%d", deviceFrameSizeLimit),
|
||||
)
|
||||
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS="+ctx.AConfig().LibartImgDeviceBaseAddress())
|
||||
if envTrue(ctx, "ART_TARGET_LINUX") {
|
||||
cflags = append(cflags, "-DART_TARGET_LINUX")
|
||||
} else {
|
||||
cflags = append(cflags, "-DART_TARGET_ANDROID")
|
||||
}
|
||||
minDelta := envDefault(ctx, "LIBART_IMG_TARGET_MIN_BASE_ADDRESS_DELTA", "-0x1000000")
|
||||
maxDelta := envDefault(ctx, "LIBART_IMG_TARGET_MAX_BASE_ADDRESS_DELTA", "0x1000000")
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS_MIN_DELTA="+minDelta)
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS_MAX_DELTA="+maxDelta)
|
||||
|
||||
return cflags
|
||||
}
|
||||
|
||||
func hostFlags(ctx android.BaseContext) []string {
|
||||
var cflags []string
|
||||
hostFrameSizeLimit := 1736
|
||||
if len(ctx.AConfig().SanitizeHost()) > 0 {
|
||||
// art/test/137-cfi/cfi.cc
|
||||
// error: stack frame size of 1944 bytes in function 'Java_Main_unwindInProcess'
|
||||
hostFrameSizeLimit = 6400
|
||||
}
|
||||
cflags = append(cflags,
|
||||
fmt.Sprintf("-Wframe-larger-than=%d", hostFrameSizeLimit),
|
||||
fmt.Sprintf("-DART_FRAME_SIZE_LIMIT=%d", hostFrameSizeLimit),
|
||||
)
|
||||
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS="+ctx.AConfig().LibartImgHostBaseAddress())
|
||||
minDelta := envDefault(ctx, "LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA", "-0x1000000")
|
||||
maxDelta := envDefault(ctx, "LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA", "0x1000000")
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS_MIN_DELTA="+minDelta)
|
||||
cflags = append(cflags, "-DART_BASE_ADDRESS_MAX_DELTA="+maxDelta)
|
||||
|
||||
return cflags
|
||||
}
|
||||
|
||||
func globalDefaults(ctx android.LoadHookContext) {
|
||||
type props struct {
|
||||
Target struct {
|
||||
Android struct {
|
||||
Cflags []string
|
||||
}
|
||||
Host struct {
|
||||
Cflags []string
|
||||
}
|
||||
}
|
||||
Cflags []string
|
||||
Asflags []string
|
||||
Sanitize struct {
|
||||
Recover []string
|
||||
}
|
||||
}
|
||||
|
||||
p := &props{}
|
||||
p.Cflags, p.Asflags = globalFlags(ctx)
|
||||
p.Target.Android.Cflags = deviceFlags(ctx)
|
||||
p.Target.Host.Cflags = hostFlags(ctx)
|
||||
|
||||
if envTrue(ctx, "ART_DEX_FILE_ACCESS_TRACKING") {
|
||||
p.Cflags = append(p.Cflags, "-DART_DEX_FILE_ACCESS_TRACKING")
|
||||
p.Sanitize.Recover = []string{
|
||||
"address",
|
||||
}
|
||||
}
|
||||
|
||||
ctx.AppendProperties(p)
|
||||
}
|
||||
|
||||
func debugDefaults(ctx android.LoadHookContext) {
|
||||
type props struct {
|
||||
Cflags []string
|
||||
}
|
||||
|
||||
p := &props{}
|
||||
p.Cflags = debugFlags(ctx)
|
||||
ctx.AppendProperties(p)
|
||||
}
|
||||
|
||||
func customLinker(ctx android.LoadHookContext) {
|
||||
linker := envDefault(ctx, "CUSTOM_TARGET_LINKER", "")
|
||||
if linker != "" {
|
||||
type props struct {
|
||||
DynamicLinker string
|
||||
}
|
||||
|
||||
p := &props{}
|
||||
p.DynamicLinker = linker
|
||||
ctx.AppendProperties(p)
|
||||
}
|
||||
}
|
||||
|
||||
func prefer32Bit(ctx android.LoadHookContext) {
|
||||
if envTrue(ctx, "HOST_PREFER_32_BIT") {
|
||||
type props struct {
|
||||
Target struct {
|
||||
Host struct {
|
||||
Compile_multilib string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p := &props{}
|
||||
p.Target.Host.Compile_multilib = "prefer32"
|
||||
ctx.AppendProperties(p)
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
android.RegisterModuleType("art_cc_library", artLibrary)
|
||||
android.RegisterModuleType("art_cc_binary", artBinary)
|
||||
android.RegisterModuleType("art_cc_test", artTest)
|
||||
android.RegisterModuleType("art_cc_test_library", artTestLibrary)
|
||||
android.RegisterModuleType("art_cc_defaults", artDefaultsFactory)
|
||||
android.RegisterModuleType("art_global_defaults", artGlobalDefaultsFactory)
|
||||
android.RegisterModuleType("art_debug_defaults", artDebugDefaultsFactory)
|
||||
}
|
||||
|
||||
func artGlobalDefaultsFactory() android.Module {
|
||||
module := artDefaultsFactory()
|
||||
android.AddLoadHook(module, globalDefaults)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func artDebugDefaultsFactory() android.Module {
|
||||
module := artDefaultsFactory()
|
||||
android.AddLoadHook(module, debugDefaults)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func artDefaultsFactory() android.Module {
|
||||
c := &codegenProperties{}
|
||||
module := cc.DefaultsFactory(c)
|
||||
android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, true) })
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func artLibrary() android.Module {
|
||||
library, _ := cc.NewLibrary(android.HostAndDeviceSupported)
|
||||
module := library.Init()
|
||||
|
||||
installCodegenCustomizer(module, true)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func artBinary() android.Module {
|
||||
binary, _ := cc.NewBinary(android.HostAndDeviceSupported)
|
||||
module := binary.Init()
|
||||
|
||||
android.AddLoadHook(module, customLinker)
|
||||
android.AddLoadHook(module, prefer32Bit)
|
||||
return module
|
||||
}
|
||||
|
||||
func artTest() android.Module {
|
||||
test := cc.NewTest(android.HostAndDeviceSupported)
|
||||
module := test.Init()
|
||||
|
||||
installCodegenCustomizer(module, false)
|
||||
|
||||
android.AddLoadHook(module, customLinker)
|
||||
android.AddLoadHook(module, prefer32Bit)
|
||||
android.AddInstallHook(module, testInstall)
|
||||
return module
|
||||
}
|
||||
|
||||
func artTestLibrary() android.Module {
|
||||
test := cc.NewTestLibrary(android.HostAndDeviceSupported)
|
||||
module := test.Init()
|
||||
|
||||
installCodegenCustomizer(module, false)
|
||||
|
||||
android.AddLoadHook(module, prefer32Bit)
|
||||
android.AddInstallHook(module, testInstall)
|
||||
return module
|
||||
}
|
||||
|
||||
func envDefault(ctx android.BaseContext, key string, defaultValue string) string {
|
||||
ret := ctx.AConfig().Getenv(key)
|
||||
if ret == "" {
|
||||
return defaultValue
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func envTrue(ctx android.BaseContext, key string) bool {
|
||||
return ctx.AConfig().Getenv(key) == "true"
|
||||
}
|
||||
|
||||
func envFalse(ctx android.BaseContext, key string) bool {
|
||||
return ctx.AConfig().Getenv(key) == "false"
|
||||
}
|
164
android/art/build/codegen.go
Normal file
164
android/art/build/codegen.go
Normal file
|
@ -0,0 +1,164 @@
|
|||
// Copyright (C) 2016 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package art
|
||||
|
||||
// This file implements the "codegen" property to apply different properties based on the currently
|
||||
// selected codegen arches, which defaults to all arches on the host and the primary and secondary
|
||||
// arches on the device.
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func codegen(ctx android.LoadHookContext, c *codegenProperties, library bool) {
|
||||
var hostArches, deviceArches []string
|
||||
|
||||
e := envDefault(ctx, "ART_HOST_CODEGEN_ARCHS", "")
|
||||
if e == "" {
|
||||
hostArches = supportedArches
|
||||
} else {
|
||||
hostArches = strings.Split(e, " ")
|
||||
}
|
||||
|
||||
e = envDefault(ctx, "ART_TARGET_CODEGEN_ARCHS", "")
|
||||
if e == "" {
|
||||
deviceArches = defaultDeviceCodegenArches(ctx)
|
||||
} else {
|
||||
deviceArches = strings.Split(e, " ")
|
||||
}
|
||||
|
||||
addCodegenArchProperties := func(host bool, archName string) {
|
||||
type props struct {
|
||||
Target struct {
|
||||
Android *CodegenCommonArchProperties
|
||||
Host *CodegenCommonArchProperties
|
||||
}
|
||||
}
|
||||
|
||||
type libraryProps struct {
|
||||
Target struct {
|
||||
Android *CodegenLibraryArchProperties
|
||||
Host *CodegenLibraryArchProperties
|
||||
}
|
||||
}
|
||||
|
||||
var arch *codegenArchProperties
|
||||
switch archName {
|
||||
case "arm":
|
||||
arch = &c.Codegen.Arm
|
||||
case "arm64":
|
||||
arch = &c.Codegen.Arm64
|
||||
case "mips":
|
||||
arch = &c.Codegen.Mips
|
||||
case "mips64":
|
||||
arch = &c.Codegen.Mips64
|
||||
case "x86":
|
||||
arch = &c.Codegen.X86
|
||||
case "x86_64":
|
||||
arch = &c.Codegen.X86_64
|
||||
default:
|
||||
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 _, arch := range deviceArches {
|
||||
addCodegenArchProperties(false, arch)
|
||||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for _, arch := range hostArches {
|
||||
addCodegenArchProperties(true, arch)
|
||||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type CodegenCommonArchProperties struct {
|
||||
Srcs []string
|
||||
Cflags []string
|
||||
}
|
||||
|
||||
type CodegenLibraryArchProperties struct {
|
||||
Static struct {
|
||||
Whole_static_libs []string
|
||||
}
|
||||
Shared struct {
|
||||
Shared_libs []string
|
||||
}
|
||||
}
|
||||
|
||||
type codegenArchProperties struct {
|
||||
CodegenCommonArchProperties
|
||||
CodegenLibraryArchProperties
|
||||
}
|
||||
|
||||
type codegenProperties struct {
|
||||
Codegen struct {
|
||||
Arm, Arm64, Mips, Mips64, X86, X86_64 codegenArchProperties
|
||||
}
|
||||
}
|
||||
|
||||
type codegenCustomizer struct {
|
||||
library bool
|
||||
codegenProperties codegenProperties
|
||||
}
|
||||
|
||||
func defaultDeviceCodegenArches(ctx android.LoadHookContext) []string {
|
||||
arches := make(map[string]bool)
|
||||
for _, a := range ctx.DeviceConfig().Arches() {
|
||||
s := a.ArchType.String()
|
||||
arches[s] = true
|
||||
if s == "arm64" {
|
||||
arches["arm"] = true
|
||||
} else if s == "mips64" {
|
||||
arches["mips"] = true
|
||||
} else if s == "x86_64" {
|
||||
arches["x86"] = true
|
||||
}
|
||||
}
|
||||
ret := make([]string, 0, len(arches))
|
||||
for a := range arches {
|
||||
ret = append(ret, a)
|
||||
}
|
||||
sort.Strings(ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
func installCodegenCustomizer(module android.Module, library bool) {
|
||||
c := &codegenProperties{}
|
||||
android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, library) })
|
||||
module.AddProperties(c)
|
||||
}
|
47
android/art/build/makevars.go
Normal file
47
android/art/build/makevars.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright (C) 2016 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package art
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
var (
|
||||
pctx = android.NewPackageContext("android/soong/art")
|
||||
)
|
||||
|
||||
func init() {
|
||||
android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
|
||||
}
|
||||
|
||||
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], " "))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue