blob: 0ac533b1301b0a558e7488756331ab6522da7f89 [file] [log] [blame]
Brian Muramatsu2f8eead2010-09-24 14:56:43 -07001#
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
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070020cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage
21dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070022
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070023coverage_out := $(HOST_OUT)/cts-api-coverage
Ying Wang50889ab2010-12-01 16:29:54 -080024
Jared Lim80939542019-03-26 17:26:53 -070025api_xml_description := $(TARGET_OUT_COMMON_INTERMEDIATES)/api.xml
Ying Wang50889ab2010-12-01 16:29:54 -080026
Sam Lin921218b2017-09-26 14:21:33 -070027napi_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
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070034cts-test-coverage-report := $(coverage_out)/test-coverage.html
35cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html
Keun young Park506ca412012-08-28 10:52:31 -070036cts-combined-coverage-report := $(coverage_out)/combined-coverage.html
Nicholas Sauer0130e902015-12-23 20:37:15 -080037cts-combined-xml-coverage-report := $(coverage_out)/combined-coverage.xml
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070038
Sam Lin921218b2017-09-26 14:21:33 -070039cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) $(napi_xml_description)
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070040
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070041android_cts_zip := $(HOST_OUT)/cts/android-cts.zip
Nicholas Sauer12b986f2016-01-06 10:54:44 -080042cts_verifier_apk := $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk
43
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070044$(cts-test-coverage-report): PRIVATE_TEST_CASES := $(COMPATIBILITY_TESTCASES_OUT_cts)
Ying Wang697ebf02013-08-01 11:09:25 -070045$(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)
Sam Lin921218b2017-09-26 14:21:33 -070048$(cts-test-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080049$(cts-test-coverage-report) : $(android_cts_zip) $(cts_api_coverage_dependencies) | $(ACP)
Sam Lin921218b2017-09-26 14:21:33 -070050 $(call generate-coverage-report-cts,"CTS Tests API-NDK Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080051 $(PRIVATE_TEST_CASES),html)
Brian Muramatsu4b32d082010-12-02 13:08:44 -080052
Nicholas Sauer12b986f2016-01-06 10:54:44 -080053$(cts-verifier-coverage-report): PRIVATE_TEST_CASES := $(cts_verifier_apk)
Ying Wang697ebf02013-08-01 11:09:25 -070054$(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)
Sam Lin921218b2017-09-26 14:21:33 -070057$(cts-verifier-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080058$(cts-verifier-coverage-report) : $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Lin921218b2017-09-26 14:21:33 -070059 $(call generate-coverage-report-cts,"CTS Verifier API Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080060 $(PRIVATE_TEST_CASES),html)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070061
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070062$(cts-combined-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c))
Ying Wang697ebf02013-08-01 11:09:25 -070063$(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)
Sam Lin921218b2017-09-26 14:21:33 -070066$(cts-combined-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080067$(cts-combined-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Lin921218b2017-09-26 14:21:33 -070068 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080069 $(PRIVATE_TEST_CASES),html)
Keun young Park506ca412012-08-28 10:52:31 -070070
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070071$(cts-combined-xml-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c))
Nicholas Sauer0130e902015-12-23 20:37:15 -080072$(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)
Sam Lin921218b2017-09-26 14:21:33 -070075$(cts-combined-xml-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080076$(cts-combined-xml-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Lin921218b2017-09-26 14:21:33 -070077 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report - XML",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080078 $(PRIVATE_TEST_CASES),xml)
Nicholas Sauer0130e902015-12-23 20:37:15 -080079
Ying Wang50889ab2010-12-01 16:29:54 -080080.PHONY: cts-test-coverage
81cts-test-coverage : $(cts-test-coverage-report)
82
Brian Muramatsu4b32d082010-12-02 13:08:44 -080083.PHONY: cts-verifier-coverage
84cts-verifier-coverage : $(cts-verifier-coverage-report)
85
Keun young Park506ca412012-08-28 10:52:31 -070086.PHONY: cts-combined-coverage
87cts-combined-coverage : $(cts-combined-coverage-report)
88
Nicholas Sauer0130e902015-12-23 20:37:15 -080089.PHONY: cts-combined-xml-coverage
90cts-combined-xml-coverage : $(cts-combined-xml-coverage-report)
91
Dan Willemsen02b5fb82018-06-19 16:38:24 -070092.PHONY: cts-coverage-report-all cts-api-coverage
Guang Zhu75f8dfd2018-04-13 10:22:42 -070093cts-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)
Ying Wang50889ab2010-12-01 16:29:54 -0800100
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700101# Arguments;
102# 1 - Name of the report printed out on the screen
Ying Wang1a833732013-07-10 11:29:35 -0700103# 2 - List of apk files that will be scanned to generate the report
104# 3 - Format of the report
Sam Lin921218b2017-09-26 14:21:33 -0700105define generate-coverage-report-cts
Ying Wang697ebf02013-08-01 11:09:25 -0700106 $(hide) mkdir -p $(dir $@)
Sam Lin921218b2017-09-26 14:21:33 -0700107 $(hide) $(PRIVATE_CTS_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -n $(PRIVATE_NAPI_XML_DESC) -f $(3) -o $@ $(2)
Dan Willemsen4483b292017-10-06 11:25:33 -0700108 @ echo $(1): file://$$(cd $(dir $@); pwd)/$(notdir $@)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700109endef
Ying Wang697ebf02013-08-01 11:09:25 -0700110
111# Reset temp vars
112cts_api_coverage_dependencies :=
Ying Wang697ebf02013-08-01 11:09:25 -0700113cts-combined-coverage-report :=
Nicholas Sauer0130e902015-12-23 20:37:15 -0800114cts-combined-xml-coverage-report :=
Ying Wang697ebf02013-08-01 11:09:25 -0700115cts-verifier-coverage-report :=
116cts-test-coverage-report :=
117api_xml_description :=
118api_text_description :=
Sam Lin921218b2017-09-26 14:21:33 -0700119napi_xml_description :=
120napi_text_description :=
Ying Wang697ebf02013-08-01 11:09:25 -0700121coverage_out :=
122dexdeps_exe :=
123cts_api_coverage_exe :=
Nicholas Sauereeb749c2016-01-05 17:42:50 -0800124cts_verifier_apk :=
Nicholas Sauer12b986f2016-01-06 10:54:44 -0800125android_cts_zip :=