1# 2# Copyright (C) 2010 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# Makefile for producing CTS coverage reports. 18# Run "make cts-test-coverage" in the $ANDROID_BUILD_TOP directory. 19 20cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage 21dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps 22 23coverage_out := $(HOST_OUT)/cts-api-coverage 24 25api_xml_description := $(TARGET_OUT_COMMON_INTERMEDIATES)/api.xml 26 27napi_text_description := cts/tools/cts-api-coverage/etc/ndk-api.xml 28napi_xml_description := $(coverage_out)/ndk-api.xml 29$(napi_xml_description) : $(napi_text_description) $(ACP) 30 $(hide) echo "Preparing NDK API XML: $@" 31 $(hide) mkdir -p $(dir $@) 32 $(hide) $(ACP) $< $@ 33 34cts-test-coverage-report := $(coverage_out)/test-coverage.html 35cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html 36cts-combined-coverage-report := $(coverage_out)/combined-coverage.html 37cts-combined-xml-coverage-report := $(coverage_out)/combined-coverage.xml 38 39cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) $(napi_xml_description) 40 41android_cts_zip := $(HOST_OUT)/cts/android-cts.zip 42cts_verifier_apk := $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk 43 44$(cts-test-coverage-report): PRIVATE_TEST_CASES := $(COMPATIBILITY_TESTCASES_OUT_cts) 45$(cts-test-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) 46$(cts-test-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) 47$(cts-test-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) 48$(cts-test-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description) 49$(cts-test-coverage-report) : $(android_cts_zip) $(cts_api_coverage_dependencies) | $(ACP) 50 $(call generate-coverage-report-cts,"CTS Tests API-NDK Coverage Report",\ 51 $(PRIVATE_TEST_CASES),html) 52 53$(cts-verifier-coverage-report): PRIVATE_TEST_CASES := $(cts_verifier_apk) 54$(cts-verifier-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) 55$(cts-verifier-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) 56$(cts-verifier-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) 57$(cts-verifier-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description) 58$(cts-verifier-coverage-report) : $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) 59 $(call generate-coverage-report-cts,"CTS Verifier API Coverage Report",\ 60 $(PRIVATE_TEST_CASES),html) 61 62$(cts-combined-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c)) 63$(cts-combined-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) 64$(cts-combined-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) 65$(cts-combined-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) 66$(cts-combined-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description) 67$(cts-combined-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) 68 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report",\ 69 $(PRIVATE_TEST_CASES),html) 70 71$(cts-combined-xml-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c)) 72$(cts-combined-xml-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) 73$(cts-combined-xml-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) 74$(cts-combined-xml-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) 75$(cts-combined-xml-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description) 76$(cts-combined-xml-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) 77 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report - XML",\ 78 $(PRIVATE_TEST_CASES),xml) 79 80.PHONY: cts-test-coverage 81cts-test-coverage : $(cts-test-coverage-report) 82 83.PHONY: cts-verifier-coverage 84cts-verifier-coverage : $(cts-verifier-coverage-report) 85 86.PHONY: cts-combined-coverage 87cts-combined-coverage : $(cts-combined-coverage-report) 88 89.PHONY: cts-combined-xml-coverage 90cts-combined-xml-coverage : $(cts-combined-xml-coverage-report) 91 92.PHONY: cts-coverage-report-all cts-api-coverage 93cts-coverage-report-all: cts-test-coverage cts-verifier-coverage cts-combined-coverage cts-combined-xml-coverage 94 95# Put the test coverage report in the dist dir if "cts-api-coverage" is among the build goals. 96$(call dist-for-goals, cts-api-coverage, $(cts-test-coverage-report):cts-test-coverage-report.html) 97$(call dist-for-goals, cts-api-coverage, $(cts-verifier-coverage-report):cts-verifier-coverage-report.html) 98$(call dist-for-goals, cts-api-coverage, $(cts-combined-coverage-report):cts-combined-coverage-report.html) 99$(call dist-for-goals, cts-api-coverage, $(cts-combined-xml-coverage-report):cts-combined-coverage-report.xml) 100 101# Arguments; 102# 1 - Name of the report printed out on the screen 103# 2 - List of apk files that will be scanned to generate the report 104# 3 - Format of the report 105define generate-coverage-report-cts 106 $(hide) mkdir -p $(dir $@) 107 $(hide) $(PRIVATE_CTS_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -n $(PRIVATE_NAPI_XML_DESC) -f $(3) -o $@ $(2) 108 @ echo $(1): file://$$(cd $(dir $@); pwd)/$(notdir $@) 109endef 110 111# Reset temp vars 112cts_api_coverage_dependencies := 113cts-combined-coverage-report := 114cts-combined-xml-coverage-report := 115cts-verifier-coverage-report := 116cts-test-coverage-report := 117api_xml_description := 118api_text_description := 119napi_xml_description := 120napi_text_description := 121coverage_out := 122dexdeps_exe := 123cts_api_coverage_exe := 124cts_verifier_apk := 125android_cts_zip := 126