1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# ==========================================================
18# Setup some common variables for the different build
19# targets here.
20# ==========================================================
21LOCAL_PATH:= $(call my-dir)
22
23testFiles := \
24    AppAsLib_test.cpp \
25    AttributeFinder_test.cpp \
26    ByteBucketArray_test.cpp \
27    Config_test.cpp \
28    ConfigLocale_test.cpp \
29    Idmap_test.cpp \
30    ResTable_test.cpp \
31    Split_test.cpp \
32    TestHelpers.cpp \
33    Theme_test.cpp \
34    TypeWrappers_test.cpp \
35    ZipUtils_test.cpp
36
37androidfw_test_cflags := \
38    -Wall \
39    -Werror \
40    -Wunused \
41    -Wunreachable-code \
42    -Wno-missing-field-initializers \
43
44# gtest is broken.
45androidfw_test_cflags += -Wno-unnamed-type-template-args
46
47# ==========================================================
48# Build the host tests: libandroidfw_tests
49# ==========================================================
50include $(CLEAR_VARS)
51
52LOCAL_MODULE := libandroidfw_tests
53LOCAL_CFLAGS := $(androidfw_test_cflags)
54LOCAL_SRC_FILES := $(testFiles)
55LOCAL_STATIC_LIBRARIES := \
56    libandroidfw \
57    libutils \
58    libcutils \
59    liblog \
60    libz \
61
62include $(BUILD_HOST_NATIVE_TEST)
63
64# ==========================================================
65# Build the device tests: libandroidfw_tests
66# ==========================================================
67ifneq ($(SDK_ONLY),true)
68include $(CLEAR_VARS)
69
70LOCAL_MODULE := libandroidfw_tests
71LOCAL_CFLAGS := $(androidfw_test_cflags)
72LOCAL_SRC_FILES := $(testFiles) \
73    BackupData_test.cpp \
74    ObbFile_test.cpp \
75
76LOCAL_SHARED_LIBRARIES := \
77    libandroidfw \
78    libcutils \
79    libutils \
80    libui \
81
82include $(BUILD_NATIVE_TEST)
83endif # Not SDK_ONLY
84
85