diff options
author | Nicolas Catania <niko@google.com> | 2010-02-10 21:47:49 -0800 |
---|---|---|
committer | Nicolas Catania <niko@google.com> | 2010-02-22 10:50:27 -0800 |
commit | c831059e003183517883381177ff312bfe00dbe9 (patch) | |
tree | f5d1aa6669809421b6e1a2ae7400afe78b01b5a1 /tests | |
parent | 464136e01a1facf09ce3befccbfc04f2d1da8d5b (diff) | |
download | astl-c831059e003183517883381177ff312bfe00dbe9.tar.gz |
Cleanup the ASTL makefiles.
src/Android.mk:
Removed empty lines.
Removed the ifdef ASTL_TESTS guard and replaced it with a
HOST_OS == linux one. The tests will now be built by default
for the targets and on linux hosts.
Renamed the host module name to libastl_host. Now need to submit
a CL to fix the gtest project before this one can go in.
tests/Android.mk:
Test targets ends with _host to avoid multiple modules (host vs target) with
the same name.
Removed verbosity of the makefile (dropped the $(info xxx) statements).
Collapsed the 2 define tests into one (similar to the one in the gtest package).
Extracted the common include directives to a new libastl_test_includes var.
Got rid of unused EXTRA_CFLAGS (uses LOCAL_C_INCLUDES) and EXTRA_LDFLAGS.
Removed the ASTL_TESTS guard, the tests will always be built.
A host version is built on Linux to run under valgrind.
Forces the tests to go under /data and not /system/bin
Tested: Build on linux for passion-eng and sim-eng
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Android.mk | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/tests/Android.mk b/tests/Android.mk index dab455a..db4c4b4 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -13,48 +13,51 @@ # limitations under the License. # -# define the ASTL_TESTS environment variable to build the test programs -ifdef ASTL_TESTS +# To integrate with the nightly build, we use +# LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) +# to put the tests under /data and not /system/bin (default). LOCAL_PATH := $(call my-dir) -# used to define a simple test program and build it as a standalone -# device executable. -# -# you can use EXTRA_CFLAGS to indicate additional CFLAGS to use -# in the build. the variable will be cleaned on exit -# -define device-test - $(foreach file,$(1), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE))) \ - $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ - $(eval LOCAL_MODULE_TAGS := tests) \ - $(eval LOCAL_STATIC_LIBRARIES := libastl) \ - $(eval include $(BUILD_EXECUTABLE)) \ - ) \ - $(eval EXTRA_CFLAGS :=) +libastl_test_includes:= \ + bionic/libstdc++/include \ + external/astl/include +libastl_test_static_lib := libastl +libastl_test_host_static_lib := libastl_host + +# $(3) and $(5) must be set or cleared in sync. $(3) is used to +# generate the right make target (host vs device). $(5) is used in the +# module's name to have different name for the host vs device +# builds. Also $(5) is used to pickup the right set of libraries, +# typically the host libs have a _host suffix in their names. +# $(1): source list +# $(2): tags +# $(3): "HOST_" or empty +# $(4): extra CFLAGS or empty +# $(5): "_host" or empty +define _define-test +$(foreach file,$(1), \ + $(eval include $(CLEAR_VARS)) \ + $(eval LOCAL_SRC_FILES := $(file)) \ + $(eval LOCAL_C_INCLUDES := $(libastl_test_includes)) \ + $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))$(5)) \ + $(eval LOCAL_CFLAGS += $(4)) \ + $(eval LOCAL_STATIC_LIBRARIES := $(libastl_test$(5)_static_lib)) \ + $(eval LOCAL_MODULE_TAGS := $(2) ) \ + $(eval LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)) \ + $(eval include $(BUILD_$(3)EXECUTABLE)) \ +) endef -# same as 'device-test' but builds a host executable instead -# you can use EXTRA_LDLIBS to indicate additional linker flags -# +ifeq ($(HOST_OS),linux) +# Compile using the host only on linux for valgrind support. define host-test - $(foreach file,$(1), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval $(info LOCAL_MODULE=$(LOCAL_MODULE) file=$(file))) \ - $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \ - $(eval LOCAL_LDLIBS += $(EXTRA_LDLIBS)) \ - $(eval LOCAL_MODULE_TAGS := eng tests) \ - $(eval LOCAL_STATIC_LIBRARIES := libastl) \ - $(eval include $(BUILD_HOST_EXECUTABLE)) \ - ) \ - $(eval EXTRA_CFLAGS :=) \ - $(eval EXTRA_LDLIBS :=) +$(call _define-test,$(1),eng,HOST_,-O0 -g,_host) +endef +endif + +define target-test +$(call _define-test,$(1),eng tests) endef sources := \ @@ -77,11 +80,9 @@ sources := \ test_uninitialized.cpp \ test_vector.cpp -# Disable all optimization for the host target to help test tools (valgrind...) -EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include -g -O0 +ifeq ($(HOST_OS),linux) $(call host-test, $(sources)) +endif -EXTRA_CFLAGS := -I bionic/libstdc++/include -I external/astl/include $(call device-test, $(sources)) -endif #ASTL_TESTS |