[go: nahoru, domu]

15ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# Copyright (C) 2015 The Android Open Source Project
25ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills#
35ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# Licensed under the Apache License, Version 2.0 (the "License");
45ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# you may not use this file except in compliance with the License.
55ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# You may obtain a copy of the License at
65ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills#
75ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills#      http://www.apache.org/licenses/LICENSE-2.0
85ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills#
95ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# Unless required by applicable law or agreed to in writing, software
105ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# distributed under the License is distributed on an "AS IS" BASIS,
115ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# See the License for the specific language governing permissions and
135ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills# limitations under the License.
145ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
155ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell WillsLOCAL_PATH:= $(call my-dir)
16956f54b391677d78379729dd14518edddf3c7660Etan Cohen
17956f54b391677d78379729dd14518edddf3c7660Etan Cohen# Make mock HAL library
18956f54b391677d78379729dd14518edddf3c7660Etan Cohen# ============================================================
19956f54b391677d78379729dd14518edddf3c7660Etan Cohen
20956f54b391677d78379729dd14518edddf3c7660Etan Coheninclude $(CLEAR_VARS)
21956f54b391677d78379729dd14518edddf3c7660Etan Cohen
22956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_REQUIRED_MODULES :=
23956f54b391677d78379729dd14518edddf3c7660Etan Cohen
24208f92c4d8457374ff507996d58ffa5586d1ecd5Mitchell WillsLOCAL_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-function \
25208f92c4d8457374ff507996d58ffa5586d1ecd5Mitchell Wills                -Wunused-variable -Winit-self -Wwrite-strings -Wshadow
26956f54b391677d78379729dd14518edddf3c7660Etan Cohen
27956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_C_INCLUDES += \
28956f54b391677d78379729dd14518edddf3c7660Etan Cohen	$(JNI_H_INCLUDE) \
29956f54b391677d78379729dd14518edddf3c7660Etan Cohen	$(LOCAL_PATH)/../../service/jni \
30956f54b391677d78379729dd14518edddf3c7660Etan Cohen	$(call include-path-for, libhardware)/hardware \
31956f54b391677d78379729dd14518edddf3c7660Etan Cohen	$(call include-path-for, libhardware_legacy)/hardware_legacy \
32956f54b391677d78379729dd14518edddf3c7660Etan Cohen	packages/apps/Test/connectivity/sl4n/rapidjson/include \
33956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libcore/include
34956f54b391677d78379729dd14518edddf3c7660Etan Cohen
35956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_SRC_FILES := \
36956f54b391677d78379729dd14518edddf3c7660Etan Cohen	jni/wifi_hal_mock.cpp
37956f54b391677d78379729dd14518edddf3c7660Etan Cohen
38956f54b391677d78379729dd14518edddf3c7660Etan Cohenifdef INCLUDE_NAN_FEATURE
39956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_SRC_FILES += \
40956f54b391677d78379729dd14518edddf3c7660Etan Cohen	jni/wifi_nan_hal_mock.cpp
41956f54b391677d78379729dd14518edddf3c7660Etan Cohenendif
42956f54b391677d78379729dd14518edddf3c7660Etan Cohen
43956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_MODULE := libwifi-hal-mock
44956f54b391677d78379729dd14518edddf3c7660Etan Cohen
45956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_STATIC_LIBRARIES += libwifi-hal
46956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_SHARED_LIBRARIES += \
47956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libnativehelper \
48956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libcutils \
49956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libutils \
50956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libhardware \
51956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libhardware_legacy \
52956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libnl \
53956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libdl \
54956f54b391677d78379729dd14518edddf3c7660Etan Cohen	libwifi-service
55956f54b391677d78379729dd14518edddf3c7660Etan Cohen
56956f54b391677d78379729dd14518edddf3c7660Etan Coheninclude $(BUILD_SHARED_LIBRARY)
57956f54b391677d78379729dd14518edddf3c7660Etan Cohen
58956f54b391677d78379729dd14518edddf3c7660Etan Cohen# Make test APK
59956f54b391677d78379729dd14518edddf3c7660Etan Cohen# ============================================================
605ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Willsinclude $(CLEAR_VARS)
615ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
625ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell WillsLOCAL_MODULE_TAGS := tests
635ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
64eee1d479d8d402a2e78e2f143e957030cfc77749Vinit DeshpandeRESOURCE_FILES := $(call all-named-files-under, R.java, $(intermediates.COMMON))
65eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande
66eee1d479d8d402a2e78e2f143e957030cfc77749Vinit DeshpandeLOCAL_SRC_FILES := $(call all-subdir-java-files) \
67eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande	$RESOURCE_FILES
685ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
69956f54b391677d78379729dd14518edddf3c7660Etan Cohenifndef INCLUDE_NAN_FEATURE
70956f54b391677d78379729dd14518edddf3c7660Etan CohenLOCAL_SRC_FILES := $(filter-out $(call all-java-files-under, \
71956f54b391677d78379729dd14518edddf3c7660Etan Cohen          src/com/android/server/wifi/nan),$(LOCAL_SRC_FILES))
72956f54b391677d78379729dd14518edddf3c7660Etan Cohenendif
73956f54b391677d78379729dd14518edddf3c7660Etan Cohen
74a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Provide jack a list of classes to exclude form code coverage
75a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# This list is generated from the java source files in this module
76a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# The list is a comma separated list of class names with * matching zero or more characters.
77a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Example:
78a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills#   Input files: src/com/android/server/wifi/Test.java src/com/android/server/wifi/AnotherTest.java
79a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills#   Generated exclude list: com.android.server.wifi.Test*,com.android.server.wifi.AnotherTest*
80a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills
81a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Filter all src files to just java files
82a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willslocal_java_files := $(filter %.java,$(LOCAL_SRC_FILES))
83a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Transform java file names into full class names.
84a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# This only works if the class name matches the file name and the directory structure
85a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# matches the package.
86a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willslocal_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
87a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Utility variables to allow replacing a space with a comma
88a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willscomma:= ,
89a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willsempty:=
90a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willsspace:= $(empty) $(empty)
91a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# Convert class name list to jacoco exclude list
92a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# This appends a * to all classes and replace the space separators with commas.
93a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills# These patterns will match all classes in this module and their inner classes.
94a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willsjacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
95a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills
96a54db13528fa8b586d58b42aff46df40466ea950Mitchell Willsjacoco_include := com.android.server.wifi.*,android.net.wifi.*
97a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills
9805fca10c16c990e610c627f11dabb7552075ba05Sebastien HertzLOCAL_JACK_COVERAGE_INCLUDE_FILTER := $(jacoco_include)
9905fca10c16c990e610c627f11dabb7552075ba05Sebastien HertzLOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude)
100a54db13528fa8b586d58b42aff46df40466ea950Mitchell Wills
1012977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# wifi-service and services must be included here so that the latest changes
1022977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# will be used when tests. Otherwise the tests would run against the installed
1032977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# system.
1042977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# TODO figure out if this is the correct thing to do, this seems to not be right
1052977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# since neither is declared a static java library.
1065ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell WillsLOCAL_STATIC_JAVA_LIBRARIES := \
1075ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills	android-support-test \
1082977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills	mockito-target \
1092977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills	services \
1105ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills	wifi-service \
1115ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
1122977ce6833c307ce5a597c56060567da4707f8bbMitchell WillsLOCAL_JAVA_LIBRARIES := \
1132977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills	android.test.runner \
1145ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills	wifi-service \
1152977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills	services \
1165ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
1172977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# These must be explicitly included because they are not normally accessible
1182977ce6833c307ce5a597c56060567da4707f8bbMitchell Wills# from apps.
1190d83625c25353c92c123f552939eea4b33074b60Mitchell WillsLOCAL_JNI_SHARED_LIBRARIES := \
1200d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libwifi-service \
1210d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libc++ \
1220d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libLLVM \
1230d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libutils \
1240d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libunwind \
1250d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libhardware_legacy \
1260d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libbase \
1270d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libhardware \
1280d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libnl \
1290d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libcutils \
1300d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libnetutils \
1310d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libbacktrace \
1320d83625c25353c92c123f552939eea4b33074b60Mitchell Wills	libnativehelper \
133d39cacb7a5ae9150b3a68b097614c5be697e5751Mitchell Wills	liblzma \
1340d83625c25353c92c123f552939eea4b33074b60Mitchell Wills
13580a936cbedcec10cf81d3ae6d457fb6812a7e9eaMitchell Willsifdef WPA_SUPPLICANT_VERSION
1362977ce6833c307ce5a597c56060567da4707f8bbMitchell WillsLOCAL_JNI_SHARED_LIBRARIES += libwpa_client
13780a936cbedcec10cf81d3ae6d457fb6812a7e9eaMitchell Willsendif
13880a936cbedcec10cf81d3ae6d457fb6812a7e9eaMitchell Wills
1395ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell WillsLOCAL_PACKAGE_NAME := FrameworksWifiTests
14064052d48e8fb56e03732ce73c7adaf1fe085bad0Etan CohenLOCAL_JNI_SHARED_LIBRARIES += libwifi-hal-mock
1415ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Wills
1425ba6152092301bbdea7e2838727b63dc40dd8c4aMitchell Willsinclude $(BUILD_PACKAGE)
143