Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82cb38e5 authored by Dan Albert's avatar Dan Albert
Browse files

Fix a wonderful copy/paste time bomb.

While trying to move projects over to libc++, I came across a link
error where these tests were failing to link when built with mma, but
not with mm. When building with mma, they would fail to link because
of symbols missing from the NDK's stlport. Huh?

When cleaning up this makefile a while ago, I removed the redundant
static_libraries := gtest/stlport, but missed removing the
LOCAL_STATIC_LIBRARIES :+ $(static_libraries).  The Android.mk in
bootable/recovery/tests was being loaded before this one, and _did_ in
fact define static_libraries. It defined it to, redundantly, include
the stlport flavored gtest libraries (another wonderful piece of
copy/paste if I do say so myself). Because of this, running mma with
this project set to use libc++ meant that the final binary was linked
with not just libc++ and the libc++ gtest libraries, but also the
stlport gtest libraries and the NDK's stlport.

Change-Id: Ibc545f95f701126ec9f0d0d0ac3d2a0feba78f8a
parent 69c8d39d
Loading
Loading
Loading
Loading
+35 −32
Original line number Diff line number Diff line
# Build the unit tests.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
#
# Copyright (C) 2014 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.
#

# Build the unit tests.
test_src_files := \
    InputReader_test.cpp \
    InputDispatcher_test.cpp
LOCAL_PATH:= $(call my-dir)

shared_libraries := \
    libcutils \
INPUT_SERVICE_TEST_SHARED_LIBRARIES := \
    liblog \
    libandroidfw \
    libutils \
    libhardware \
    libhardware_legacy \
    libui \
    libskia \
    libinput \
    libinputservice

c_includes := \
    external/skia/include/core

module_tags := eng tests
    libskia \
    libinputservice \

$(foreach file,$(test_src_files), \
    $(eval include $(CLEAR_VARS)) \
    $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
    $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
    $(eval LOCAL_C_INCLUDES := $(c_includes)) \
    $(eval LOCAL_SRC_FILES := $(file)) \
    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
    $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
    $(eval include $(BUILD_NATIVE_TEST)) \
)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := InputReader_test
LOCAL_MODULE_TAGS := eng tests
LOCAL_C_INCLUDES := external/skia/include/core
LOCAL_SRC_FILES := InputReader_test.cpp
LOCAL_SHARED_LIBRARIES := $(INPUT_SERVICE_TEST_SHARED_LIBRARIES)
include $(BUILD_NATIVE_TEST)

# Build the manual test programs.
include $(call all-makefiles-under, $(LOCAL_PATH))
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := InputDispatcher_test
LOCAL_MODULE_TAGS := eng tests
LOCAL_C_INCLUDES := external/skia/include/core
LOCAL_SRC_FILES := InputDispatcher_test.cpp
LOCAL_SHARED_LIBRARIES := $(INPUT_SERVICE_TEST_SHARED_LIBRARIES)
include $(BUILD_NATIVE_TEST)