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 # ========================================================== 21 LOCAL_PATH:= $(call my-dir) 22 23 testFiles := \ 24 ApkAssets_test.cpp \ 25 AppAsLib_test.cpp \ 26 Asset_test.cpp \ 27 AssetManager2_test.cpp \ 28 AttributeFinder_test.cpp \ 29 AttributeResolution_test.cpp \ 30 ByteBucketArray_test.cpp \ 31 Config_test.cpp \ 32 ConfigLocale_test.cpp \ 33 Idmap_test.cpp \ 34 LoadedArsc_test.cpp \ 35 ResourceUtils_test.cpp \ 36 ResTable_test.cpp \ 37 Split_test.cpp \ 38 StringPiece_test.cpp \ 39 TestHelpers.cpp \ 40 TestMain.cpp \ 41 Theme_test.cpp \ 42 TypeWrappers_test.cpp \ 43 ZipUtils_test.cpp 44 45 benchmarkFiles := \ 46 AssetManager2_bench.cpp \ 47 BenchMain.cpp \ 48 BenchmarkHelpers.cpp \ 49 SparseEntry_bench.cpp \ 50 TestHelpers.cpp \ 51 Theme_bench.cpp 52 53 androidfw_test_cflags := \ 54 -Wall \ 55 -Werror \ 56 -Wunused \ 57 -Wunreachable-code \ 58 -Wno-missing-field-initializers 59 60 # gtest is broken. 61 androidfw_test_cflags += -Wno-unnamed-type-template-args 62 63 # ========================================================== 64 # Build the host tests: libandroidfw_tests 65 # ========================================================== 66 include $(CLEAR_VARS) 67 68 LOCAL_MODULE := libandroidfw_tests 69 LOCAL_CFLAGS := $(androidfw_test_cflags) 70 LOCAL_SRC_FILES := $(testFiles) 71 LOCAL_STATIC_LIBRARIES := \ 72 libandroidfw \ 73 libbase \ 74 libutils \ 75 libcutils \ 76 liblog \ 77 libz \ 78 libziparchive 79 LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data 80 81 include $(BUILD_HOST_NATIVE_TEST) 82 83 # ========================================================== 84 # Build the device tests: libandroidfw_tests 85 # ========================================================== 86 ifneq ($(SDK_ONLY),true) 87 include $(CLEAR_VARS) 88 89 LOCAL_MODULE := libandroidfw_tests 90 LOCAL_CFLAGS := $(androidfw_test_cflags) 91 LOCAL_SRC_FILES := $(testFiles) \ 92 BackupData_test.cpp \ 93 ObbFile_test.cpp \ 94 95 LOCAL_SHARED_LIBRARIES := \ 96 libandroidfw \ 97 libbase \ 98 libcutils \ 99 libutils \ 100 libui \ 101 libziparchive 102 LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data 103 104 include $(BUILD_NATIVE_TEST) 105 106 # ========================================================== 107 # Build the device benchmarks: libandroidfw_benchmarks 108 # ========================================================== 109 include $(CLEAR_VARS) 110 111 LOCAL_MODULE := libandroidfw_benchmarks 112 LOCAL_CFLAGS := $(androidfw_test_cflags) 113 LOCAL_SRC_FILES := $(benchmarkFiles) 114 LOCAL_STATIC_LIBRARIES := \ 115 libgoogle-benchmark 116 LOCAL_SHARED_LIBRARIES := \ 117 libandroidfw \ 118 libbase \ 119 libcutils \ 120 libutils \ 121 libziparchive 122 LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data 123 124 include $(BUILD_NATIVE_TEST) 125 endif # Not SDK_ONLY 126 127