Add compile time test infrastructure for bionic.
Actual tests to follow... Bug: 17782583 Change-Id: I22857f19899c3b39dbc2e5473ad3be1a8a291139
This commit is contained in:
parent
81156d93c5
commit
f04a8bc226
|
@ -322,6 +322,51 @@ build_type := host
|
||||||
build_target := NATIVE_TEST
|
build_target := NATIVE_TEST
|
||||||
include $(LOCAL_PATH)/Android.build.mk
|
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))
|
ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
|
||||||
LINKER = linker64
|
LINKER = linker64
|
||||||
NATIVE_TEST_SUFFIX=64
|
NATIVE_TEST_SUFFIX=64
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue