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

Commit 7a92d20e authored by Dan Albert's avatar Dan Albert Committed by Gerrit Code Review
Browse files

Merge "Clean up some test makefiles."

parents a11ac455 27d166cb
Loading
Loading
Loading
Loading
+25 −12
Original line number Original line Diff line number Diff line
#
# 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.
# Build the unit tests.
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)


# Build the unit tests.
include $(CLEAR_VARS)
test_src_files := \
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

LOCAL_MODULE := libutils_tests

LOCAL_SRC_FILES := \
    BasicHashtable_test.cpp \
    BasicHashtable_test.cpp \
    BlobCache_test.cpp \
    BlobCache_test.cpp \
    BitSet_test.cpp \
    BitSet_test.cpp \
@@ -10,19 +30,12 @@ test_src_files := \
    LruCache_test.cpp \
    LruCache_test.cpp \
    String8_test.cpp \
    String8_test.cpp \
    Unicode_test.cpp \
    Unicode_test.cpp \
    Vector_test.cpp
    Vector_test.cpp \


shared_libraries := \
LOCAL_SHARED_LIBRARIES := \
    libz \
    libz \
    liblog \
    liblog \
    libcutils \
    libcutils \
    libutils \
    libutils \


$(foreach file,$(test_src_files), \
include $(BUILD_NATIVE_TEST)
    $(eval include $(CLEAR_VARS)) \
    $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
    $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
    $(eval LOCAL_SRC_FILES := $(file)) \
    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
    $(eval include $(BUILD_NATIVE_TEST)) \
)
+12 −7
Original line number Original line Diff line number Diff line
@@ -21,12 +21,12 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <unistd.h>
#include <unistd.h>


namespace android {
namespace {


typedef int SimpleKey;
typedef int SimpleKey;
typedef int SimpleValue;
typedef int SimpleValue;
typedef key_value_pair_t<SimpleKey, SimpleValue> SimpleEntry;
typedef android::key_value_pair_t<SimpleKey, SimpleValue> SimpleEntry;
typedef BasicHashtable<SimpleKey, SimpleEntry> SimpleHashtable;
typedef android::BasicHashtable<SimpleKey, SimpleEntry> SimpleHashtable;


struct ComplexKey {
struct ComplexKey {
    int k;
    int k;
@@ -56,10 +56,6 @@ struct ComplexKey {


ssize_t ComplexKey::instanceCount = 0;
ssize_t ComplexKey::instanceCount = 0;


template<> inline hash_t hash_type(const ComplexKey& value) {
    return hash_type(value.k);
}

struct ComplexValue {
struct ComplexValue {
    int v;
    int v;


@@ -80,9 +76,18 @@ struct ComplexValue {


ssize_t ComplexValue::instanceCount = 0;
ssize_t ComplexValue::instanceCount = 0;


} // namespace


namespace android {

typedef key_value_pair_t<ComplexKey, ComplexValue> ComplexEntry;
typedef key_value_pair_t<ComplexKey, ComplexValue> ComplexEntry;
typedef BasicHashtable<ComplexKey, ComplexEntry> ComplexHashtable;
typedef BasicHashtable<ComplexKey, ComplexEntry> ComplexHashtable;


template<> inline hash_t hash_type(const ComplexKey& value) {
    return hash_type(value.k);
}

class BasicHashtableTest : public testing::Test {
class BasicHashtableTest : public testing::Test {
protected:
protected:
    virtual void SetUp() {
    virtual void SetUp() {
+10 −5
Original line number Original line Diff line number Diff line
@@ -20,7 +20,7 @@
#include <cutils/log.h>
#include <cutils/log.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>


namespace android {
namespace {


typedef int SimpleKey;
typedef int SimpleKey;
typedef const char* StringValue;
typedef const char* StringValue;
@@ -53,10 +53,6 @@ struct ComplexKey {


ssize_t ComplexKey::instanceCount = 0;
ssize_t ComplexKey::instanceCount = 0;


template<> inline hash_t hash_type(const ComplexKey& value) {
    return hash_type(value.k);
}

struct ComplexValue {
struct ComplexValue {
    int v;
    int v;


@@ -77,8 +73,17 @@ struct ComplexValue {


ssize_t ComplexValue::instanceCount = 0;
ssize_t ComplexValue::instanceCount = 0;


} // namespace


namespace android {

typedef LruCache<ComplexKey, ComplexValue> ComplexCache;
typedef LruCache<ComplexKey, ComplexValue> ComplexCache;


template<> inline android::hash_t hash_type(const ComplexKey& value) {
    return hash_type(value.k);
}

class EntryRemovedCallback : public OnEntryRemoved<SimpleKey, StringValue> {
class EntryRemovedCallback : public OnEntryRemoved<SimpleKey, StringValue> {
public:
public:
    EntryRemovedCallback() : callbackCount(0), lastKey(-1), lastValue(NULL) { }
    EntryRemovedCallback() : callbackCount(0), lastKey(-1), lastValue(NULL) { }
+12 −20
Original line number Original line Diff line number Diff line
@@ -14,31 +14,27 @@
# limitations under the License.
# limitations under the License.


LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

source_files := \
	zip_archive.h \
	zip_archive.cc


source_files := zip_archive.cc
includes := external/zlib
includes := external/zlib


include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CPP_EXTENSION := .cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := ${source_files}
LOCAL_SRC_FILES := ${source_files}

LOCAL_STATIC_LIBRARIES := libz
LOCAL_STATIC_LIBRARIES := libz
LOCAL_SHARED_LIBRARIES := libutils
LOCAL_SHARED_LIBRARIES := libutils
LOCAL_MODULE:= libziparchive
LOCAL_MODULE:= libziparchive

LOCAL_C_INCLUDES += ${includes}
LOCAL_C_INCLUDES += ${includes}
LOCAL_CFLAGS := -Werror
LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)


include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := libziparchive
LOCAL_MODULE := libziparchive
LOCAL_CPP_EXTENSION := .cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := ${source_files}
LOCAL_SRC_FILES := ${source_files}
LOCAL_C_INCLUDES += ${includes}
LOCAL_C_INCLUDES += ${includes}

LOCAL_STATIC_LIBRARIES := libz libutils
LOCAL_STATIC_LIBRARIES := libz libutils
LOCAL_MODULE:= libziparchive-host
LOCAL_MODULE:= libziparchive-host
LOCAL_CFLAGS := -Werror
LOCAL_CFLAGS := -Werror
@@ -46,11 +42,11 @@ LOCAL_MULTILIB := both
include $(BUILD_HOST_STATIC_LIBRARY)
include $(BUILD_HOST_STATIC_LIBRARY)


include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := libziparchive
LOCAL_MODULE := libziparchive
LOCAL_CPP_EXTENSION := .cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := ${source_files}
LOCAL_SRC_FILES := ${source_files}
LOCAL_C_INCLUDES += ${includes}
LOCAL_C_INCLUDES += ${includes}

LOCAL_STATIC_LIBRARIES := libz libutils
LOCAL_STATIC_LIBRARIES := libz libutils
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_MODULE:= libziparchive-host
LOCAL_MODULE:= libziparchive-host
@@ -58,31 +54,27 @@ LOCAL_CFLAGS := -Werror
LOCAL_MULTILIB := both
LOCAL_MULTILIB := both
include $(BUILD_HOST_SHARED_LIBRARY)
include $(BUILD_HOST_SHARED_LIBRARY)


# Tests.
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := ziparchive-tests
LOCAL_MODULE := ziparchive-tests
LOCAL_CPP_EXTENSION := .cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += \
LOCAL_CFLAGS := -Werror
    -DGTEST_OS_LINUX_ANDROID \
    -DGTEST_HAS_STD_STRING \
    -Werror
LOCAL_SRC_FILES := zip_archive_test.cc
LOCAL_SRC_FILES := zip_archive_test.cc
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_STATIC_LIBRARIES := libziparchive libz libgtest libgtest_main libutils
LOCAL_STATIC_LIBRARIES := libziparchive libz libutils
include $(BUILD_NATIVE_TEST)
include $(BUILD_NATIVE_TEST)


include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := ziparchive-tests-host
LOCAL_MODULE := ziparchive-tests-host
LOCAL_CPP_EXTENSION := .cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += \
LOCAL_CFLAGS += \
    -DGTEST_OS_LINUX \
    -DGTEST_HAS_STD_STRING \
    -Werror \
    -Werror \
    -Wno-unnamed-type-template-args
    -Wno-unnamed-type-template-args
LOCAL_SRC_FILES := zip_archive_test.cc
LOCAL_SRC_FILES := zip_archive_test.cc
LOCAL_SHARED_LIBRARIES := libziparchive-host liblog
LOCAL_SHARED_LIBRARIES := libziparchive-host liblog
LOCAL_STATIC_LIBRARIES := \
LOCAL_STATIC_LIBRARIES := \
    libz \
    libz \
	libgtest_host \
	libgtest_main_host \
    libutils
    libutils
include $(BUILD_HOST_NATIVE_TEST)
include $(BUILD_HOST_NATIVE_TEST)