1 # 2 # Copyright (C) 2016 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 LOCAL_PATH := $(call my-dir) 18 19 include $(LOCAL_PATH)/../Android.clean.mk 20 21 test_cflags = \ 22 -fstack-protector-all \ 23 -g \ 24 -Wall -Wextra -Wunused \ 25 -Werror \ 26 -fno-builtin \ 27 28 test_cflags += -D__STDC_LIMIT_MACROS # For glibc. 29 30 test_cppflags := \ 31 32 test_executable := VtsHalLightsTestCases 33 list_executable := $(test_executable)_list 34 35 include $(CLEAR_VARS) 36 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 37 38 LOCAL_MODULE := $(test_executable) 39 LOCAL_MODULE_TAGS := optional 40 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest 41 LOCAL_MULTILIB := both 42 LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 43 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 44 45 LOCAL_SHARED_LIBRARIES += \ 46 libdl \ 47 libhardware \ 48 49 LOCAL_WHOLE_STATIC_LIBRARIES += \ 50 libHalLightsTests \ 51 libVtsGtestMain \ 52 53 LOCAL_STATIC_LIBRARIES += \ 54 libbase \ 55 libtinyxml2 \ 56 liblog \ 57 libgtest \ 58 59 # Tag this module as a vts test artifact 60 LOCAL_COMPATIBILITY_SUITE := vts 61 62 # May need more in CFLAGS. 63 LOCAL_CFLAGS += -Wall -Wextra -Werror 64 include $(BUILD_EXECUTABLE) 65 66 # VTS testcase isn't designed to be run on host due to its dependencies to 67 # libhardware or other android runtime. 68 build_host := false 69 common_additional_dependencies := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/../Android.build.mk 70 71 # ----------------------------------------------------------------------------- 72 # All standard tests. 73 # ----------------------------------------------------------------------------- 74 75 libHalLightsStandardTests_src_files := \ 76 hal_lights_basic_test.cpp 77 78 libHalLightsStandardTests_cflags := \ 79 $(test_cflags) \ 80 81 libHalLightsStandardTests_cppflags := \ 82 $(test_cppflags) \ 83 84 libHalLightsStandardTests_c_includes := \ 85 test/vts/testcases/include \ 86 external/tinyxml2 \ 87 88 libHalLightsStandardTests_static_libraries := \ 89 libbase \ 90 91 libHalLightsStandardTests_ldlibs_host := \ 92 -lrt \ 93 94 module := libHalLightsStandardTests 95 module_tag := optional 96 build_type := target 97 build_target := STATIC_TEST_LIBRARY 98 include $(LOCAL_PATH)/../Android.build.mk 99 build_type := host 100 include $(LOCAL_PATH)/../Android.build.mk 101 102 # Library of all tests (excluding the dynamic linker tests). 103 # ----------------------------------------------------------------------------- 104 libHalLightsTests_whole_static_libraries := \ 105 libHalLightsStandardTests \ 106 107 108 module := libHalLightsTests 109 module_tag := optional 110 build_type := target 111 build_target := STATIC_TEST_LIBRARY 112 include $(LOCAL_PATH)/../Android.build.mk 113 build_type := host 114 include $(LOCAL_PATH)/../Android.build.mk 115 116 # ----------------------------------------------------------------------------- 117 # Tests for the device using HAL Lights's .so. Run with: 118 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests32 119 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests64 120 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests-gcc32 121 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests-gcc64 122 # ----------------------------------------------------------------------------- 123 common_hallights-unit-tests_whole_static_libraries := \ 124 libHalLightsTests \ 125 libVtsGtestMain \ 126 127 common_hallights-unit-tests_static_libraries := \ 128 libtinyxml2 \ 129 liblog \ 130 libbase \ 131 132 # TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+) 133 common_hallights-unit-tests_src_files := \ 134 hal_lights_basic_test.cpp \ 135 136 common_hallights-unit-tests_cflags := $(test_cflags) 137 138 common_hallights-unit-tests_conlyflags := \ 139 -fexceptions \ 140 -fnon-call-exceptions \ 141 142 common_hallights-unit-tests_cppflags := \ 143 $(test_cppflags) 144 145 common_hallights-unit-tests_ldflags := \ 146 -Wl,--export-dynamic 147 148 common_hallights-unit-tests_c_includes := \ 149 bionic/libc \ 150 151 common_hallights-unit-tests_shared_libraries_target := \ 152 libdl \ 153 libhardware \ 154 libpagemap \ 155 libdl_preempt_test_1 \ 156 libdl_preempt_test_2 \ 157 libdl_test_df_1_global \ 158 159 # The order of these libraries matters, do not shuffle them. 160 common_hallights-unit-tests_static_libraries_target := \ 161 libbase \ 162 libziparchive \ 163 libz \ 164 libutils \ 165 166 module_tag := optional 167 build_type := target 168 build_target := NATIVE_TEST 169 170 module := hallights-unit-tests 171 hallights-unit-tests_clang_target := true 172 hallights-unit-tests_whole_static_libraries := $(common_hallights-unit-tests_whole_static_libraries) 173 hallights-unit-tests_static_libraries := $(common_hallights-unit-tests_static_libraries) 174 hallights-unit-tests_src_files := $(common_hallights-unit-tests_src_files) 175 hallights-unit-tests_cflags := $(common_hallights-unit-tests_cflags) 176 hallights-unit-tests_conlyflags := $(common_hallights-unit-tests_conlyflags) 177 hallights-unit-tests_cppflags := $(common_hallights-unit-tests_cppflags) 178 hallights-unit-tests_ldflags := $(common_hallights-unit-tests_ldflags) 179 hallights-unit-tests_c_includes := $(common_hallights-unit-tests_c_includes) 180 hallights-unit-tests_shared_libraries_target := $(common_hallights-unit-tests_shared_libraries_target) 181 hallights-unit-tests_static_libraries_target := $(common_hallights-unit-tests_static_libraries_target) 182 include $(LOCAL_PATH)/../Android.build.mk 183 184 module := hallights-unit-tests-gcc 185 hallights-unit-tests-gcc_clang_target := false 186 hallights-unit-tests-gcc_whole_static_libraries := $(common_hallights-unit-tests_whole_static_libraries) 187 hallights-unit-tests-gcc_static_libraries := $(common_hallights-unit-tests_static_libraries) 188 hallights-unit-tests-gcc_src_files := $(common_hallights-unit-tests_src_files) 189 hallights-unit-tests-gcc_cflags := $(common_hallights-unit-tests_cflags) 190 hallights-unit-tests-gcc_conlyflags := $(common_hallights-unit-tests_conlyflags) 191 hallights-unit-tests-gcc_cppflags := $(common_hallights-unit-tests_cppflags) 192 hallights-unit-tests-gcc_ldflags := $(common_hallights-unit-tests_ldflags) 193 hallights-unit-tests-gcc_c_includes := $(common_hallights-unit-tests_c_includes) 194 hallights-unit-tests-gcc_shared_libraries_target := $(common_hallights-unit-tests_shared_libraries_target) 195 hallights-unit-tests-gcc_static_libraries_target := $(common_hallights-unit-tests_static_libraries_target) 196 include $(LOCAL_PATH)/../Android.build.mk 197