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 include $(BUILD_EXECUTABLE) 63 64 # VTS testcase isn't designed to be run on host due to its dependencies to 65 # libhardware or other android runtime. 66 build_host := false 67 common_additional_dependencies := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/../Android.build.mk 68 69 # ----------------------------------------------------------------------------- 70 # All standard tests. 71 # ----------------------------------------------------------------------------- 72 73 libHalLightsStandardTests_src_files := \ 74 hal_lights_basic_test.cpp 75 76 libHalLightsStandardTests_cflags := \ 77 $(test_cflags) \ 78 79 libHalLightsStandardTests_cppflags := \ 80 $(test_cppflags) \ 81 82 libHalLightsStandardTests_c_includes := \ 83 test/vts/testcases/include \ 84 external/tinyxml2 \ 85 86 libHalLightsStandardTests_static_libraries := \ 87 libbase \ 88 89 libHalLightsStandardTests_ldlibs_host := \ 90 -lrt \ 91 92 module := libHalLightsStandardTests 93 module_tag := optional 94 build_type := target 95 build_target := STATIC_TEST_LIBRARY 96 include $(LOCAL_PATH)/../Android.build.mk 97 build_type := host 98 include $(LOCAL_PATH)/../Android.build.mk 99 100 # Library of all tests (excluding the dynamic linker tests). 101 # ----------------------------------------------------------------------------- 102 libHalLightsTests_whole_static_libraries := \ 103 libHalLightsStandardTests \ 104 105 106 module := libHalLightsTests 107 module_tag := optional 108 build_type := target 109 build_target := STATIC_TEST_LIBRARY 110 include $(LOCAL_PATH)/../Android.build.mk 111 build_type := host 112 include $(LOCAL_PATH)/../Android.build.mk 113 114 # ----------------------------------------------------------------------------- 115 # Tests for the device using HAL Lights's .so. Run with: 116 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests32 117 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests64 118 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests-gcc32 119 # adb shell /data/nativetest/hallights-unit-tests/hallights-unit-tests-gcc64 120 # ----------------------------------------------------------------------------- 121 common_hallights-unit-tests_whole_static_libraries := \ 122 libHalLightsTests \ 123 libVtsGtestMain \ 124 125 common_hallights-unit-tests_static_libraries := \ 126 libtinyxml2 \ 127 liblog \ 128 libbase \ 129 130 # TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+) 131 common_hallights-unit-tests_src_files := \ 132 hal_lights_basic_test.cpp \ 133 134 common_hallights-unit-tests_cflags := $(test_cflags) 135 136 common_hallights-unit-tests_conlyflags := \ 137 -fexceptions \ 138 -fnon-call-exceptions \ 139 140 common_hallights-unit-tests_cppflags := \ 141 $(test_cppflags) 142 143 common_hallights-unit-tests_ldflags := \ 144 -Wl,--export-dynamic 145 146 common_hallights-unit-tests_c_includes := \ 147 bionic/libc \ 148 149 common_hallights-unit-tests_shared_libraries_target := \ 150 libdl \ 151 libhardware \ 152 libpagemap \ 153 libdl_preempt_test_1 \ 154 libdl_preempt_test_2 \ 155 libdl_test_df_1_global \ 156 157 # The order of these libraries matters, do not shuffle them. 158 common_hallights-unit-tests_static_libraries_target := \ 159 libbase \ 160 libziparchive \ 161 libz \ 162 libutils \ 163 164 module_tag := optional 165 build_type := target 166 build_target := NATIVE_TEST 167 168 module := hallights-unit-tests 169 hallights-unit-tests_clang_target := true 170 hallights-unit-tests_whole_static_libraries := $(common_hallights-unit-tests_whole_static_libraries) 171 hallights-unit-tests_static_libraries := $(common_hallights-unit-tests_static_libraries) 172 hallights-unit-tests_src_files := $(common_hallights-unit-tests_src_files) 173 hallights-unit-tests_cflags := $(common_hallights-unit-tests_cflags) 174 hallights-unit-tests_conlyflags := $(common_hallights-unit-tests_conlyflags) 175 hallights-unit-tests_cppflags := $(common_hallights-unit-tests_cppflags) 176 hallights-unit-tests_ldflags := $(common_hallights-unit-tests_ldflags) 177 hallights-unit-tests_c_includes := $(common_hallights-unit-tests_c_includes) 178 hallights-unit-tests_shared_libraries_target := $(common_hallights-unit-tests_shared_libraries_target) 179 hallights-unit-tests_static_libraries_target := $(common_hallights-unit-tests_static_libraries_target) 180 include $(LOCAL_PATH)/../Android.build.mk 181 182 module := hallights-unit-tests-gcc 183 hallights-unit-tests-gcc_clang_target := false 184 hallights-unit-tests-gcc_whole_static_libraries := $(common_hallights-unit-tests_whole_static_libraries) 185 hallights-unit-tests-gcc_static_libraries := $(common_hallights-unit-tests_static_libraries) 186 hallights-unit-tests-gcc_src_files := $(common_hallights-unit-tests_src_files) 187 hallights-unit-tests-gcc_cflags := $(common_hallights-unit-tests_cflags) 188 hallights-unit-tests-gcc_conlyflags := $(common_hallights-unit-tests_conlyflags) 189 hallights-unit-tests-gcc_cppflags := $(common_hallights-unit-tests_cppflags) 190 hallights-unit-tests-gcc_ldflags := $(common_hallights-unit-tests_ldflags) 191 hallights-unit-tests-gcc_c_includes := $(common_hallights-unit-tests_c_includes) 192 hallights-unit-tests-gcc_shared_libraries_target := $(common_hallights-unit-tests_shared_libraries_target) 193 hallights-unit-tests-gcc_static_libraries_target := $(common_hallights-unit-tests_static_libraries_target) 194 include $(LOCAL_PATH)/../Android.build.mk 195