diff options
author | Dan Albert <danalbert@google.com> | 2014-10-03 13:46:42 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2014-10-06 11:38:01 -0700 |
commit | f04a8bc2266e4a51e1ccfb18c24ff0ae25d98d8a (patch) | |
tree | 7377a483e64bf2bed556d6c50100aed5b77bca42 /tests | |
parent | 81156d93c557e88379dd3e9d869dcc97a15293f5 (diff) | |
download | bionic-f04a8bc2266e4a51e1ccfb18c24ff0ae25d98d8a.zip bionic-f04a8bc2266e4a51e1ccfb18c24ff0ae25d98d8a.tar.gz bionic-f04a8bc2266e4a51e1ccfb18c24ff0ae25d98d8a.tar.bz2 |
Add compile time test infrastructure for bionic.
Actual tests to follow...
Bug: 17782583
Change-Id: I22857f19899c3b39dbc2e5473ad3be1a8a291139
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Android.mk | 45 | ||||
-rwxr-xr-x | tests/file-check-cxx | 13 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/Android.mk b/tests/Android.mk index d946d30..1358800 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -322,6 +322,51 @@ build_type := host build_target := NATIVE_TEST include $(LOCAL_PATH)/Android.build.mk +# ----------------------------------------------------------------------------- +# Compile time tests. +# ----------------------------------------------------------------------------- + +# Some of these are intentionally using = instead of := since we need access to +# some variables not initialtized until we're in the build system. + +include $(CLEAR_VARS) +LOCAL_ADDITIONAL_DEPENDENCIES := \ + $(LOCAL_PATH)/Android.mk \ + $(LOCAL_PATH)/file-check-cxx \ + | $(HOST_OUT_EXECUTABLES)/FileCheck$(HOST_EXECUTABLE_SUFFIX) \ + +LOCAL_CXX = $(LOCAL_PATH)/file-check-cxx \ + $(HOST_OUT_EXECUTABLES)/FileCheck \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)CXX_BARE) \ + GCC \ + +LOCAL_CLANG := false +LOCAL_MODULE := bionic-compile-time-tests-g++ +LOCAL_CXXFLAGS := -Wall +LOCAL_SRC_FILES := +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_ADDITIONAL_DEPENDENCIES := \ + $(LOCAL_PATH)/Android.mk \ + $(LOCAL_PATH)/file-check-cxx \ + | $(HOST_OUT_EXECUTABLES)/FileCheck$(HOST_EXECUTABLE_SUFFIX) \ + +LOCAL_CXX := $(LOCAL_PATH)/file-check-cxx \ + $(HOST_OUT_EXECUTABLES)/FileCheck \ + $(LLVM_PREBUILTS_PATH)/clang++ \ + CLANG \ + +LOCAL_CLANG := true +LOCAL_MODULE := bionic-compile-time-tests-clang++ +LOCAL_CXXFLAGS := -Wall +LOCAL_SRC_FILES := +include $(BUILD_STATIC_LIBRARY) + +# ----------------------------------------------------------------------------- +# Host glibc tests. +# ----------------------------------------------------------------------------- + ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86)) LINKER = linker64 NATIVE_TEST_SUFFIX=64 diff --git a/tests/file-check-cxx b/tests/file-check-cxx new file mode 100755 index 0000000..8ece835 --- /dev/null +++ b/tests/file-check-cxx @@ -0,0 +1,13 @@ +#!/bin/bash +FILECHECK=$1 +CXX=$2 +PREFIX=$3 +ARGS=${*:4} +SOURCE=$(echo $ARGS | grep -oP '\S+\.cpp\b') +OBJ=$(echo $ARGS | grep -oP '\S+\.o\b') +$CXX $ARGS 2>&1 | $FILECHECK -check-prefix=$PREFIX $SOURCE +if [ "$?" -eq 0 ]; then + touch $OBJ +else + exit 1 +fi |