blob: 895af4d8b0c291fb1042a241b3ee2992f2da6e4d [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
Ying Wangd97c2b12012-10-05 16:43:21 -070025api_text_description := frameworks/base/api/current.txt
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070026api_xml_description := $(coverage_out)/api.xml
27$(api_xml_description) : $(api_text_description) $(APICHECK)
28 $(hide) echo "Converting API file to XML: $@"
Ying Wang697ebf02013-08-01 11:09:25 -070029 $(hide) mkdir -p $(dir $@)
30 $(hide) $(APICHECK_COMMAND) -convert2xml $< $@
Ying Wang50889ab2010-12-01 16:29:54 -080031
Sam Line50cbf72017-09-26 14:21:33 -070032napi_text_description := cts/tools/cts-api-coverage/etc/ndk-api.xml
33napi_xml_description := $(coverage_out)/ndk-api.xml
34$(napi_xml_description) : $(napi_text_description) $(ACP)
35 $(hide) echo "Preparing NDK API XML: $@"
36 $(hide) mkdir -p $(dir $@)
37 $(hide) $(ACP) $< $@
38
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070039cts-test-coverage-report := $(coverage_out)/test-coverage.html
40cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html
Keun young Park506ca412012-08-28 10:52:31 -070041cts-combined-coverage-report := $(coverage_out)/combined-coverage.html
Nicholas Sauer0130e902015-12-23 20:37:15 -080042cts-combined-xml-coverage-report := $(coverage_out)/combined-coverage.xml
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070043
Sam Line50cbf72017-09-26 14:21:33 -070044cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) $(napi_xml_description)
Brian Muramatsu61bd88c2011-04-11 13:48:08 -070045
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070046android_cts_zip := $(HOST_OUT)/cts/android-cts.zip
Nicholas Sauer12b986f2016-01-06 10:54:44 -080047cts_verifier_apk := $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk
48
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070049$(cts-test-coverage-report): PRIVATE_TEST_CASES := $(COMPATIBILITY_TESTCASES_OUT_cts)
Ying Wang697ebf02013-08-01 11:09:25 -070050$(cts-test-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe)
51$(cts-test-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe)
52$(cts-test-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description)
Sam Line50cbf72017-09-26 14:21:33 -070053$(cts-test-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080054$(cts-test-coverage-report) : $(android_cts_zip) $(cts_api_coverage_dependencies) | $(ACP)
Sam Line50cbf72017-09-26 14:21:33 -070055 $(call generate-coverage-report-cts,"CTS Tests API-NDK Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080056 $(PRIVATE_TEST_CASES),html)
Brian Muramatsu4b32d082010-12-02 13:08:44 -080057
Nicholas Sauer12b986f2016-01-06 10:54:44 -080058$(cts-verifier-coverage-report): PRIVATE_TEST_CASES := $(cts_verifier_apk)
Ying Wang697ebf02013-08-01 11:09:25 -070059$(cts-verifier-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe)
60$(cts-verifier-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe)
61$(cts-verifier-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description)
Sam Line50cbf72017-09-26 14:21:33 -070062$(cts-verifier-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080063$(cts-verifier-coverage-report) : $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Line50cbf72017-09-26 14:21:33 -070064 $(call generate-coverage-report-cts,"CTS Verifier API Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080065 $(PRIVATE_TEST_CASES),html)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070066
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070067$(cts-combined-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c))
Ying Wang697ebf02013-08-01 11:09:25 -070068$(cts-combined-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe)
69$(cts-combined-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe)
70$(cts-combined-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description)
Sam Line50cbf72017-09-26 14:21:33 -070071$(cts-combined-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080072$(cts-combined-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Line50cbf72017-09-26 14:21:33 -070073 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080074 $(PRIVATE_TEST_CASES),html)
Keun young Park506ca412012-08-28 10:52:31 -070075
Nicholas Sauer3a2cc272016-08-12 07:56:00 -070076$(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 -080077$(cts-combined-xml-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe)
78$(cts-combined-xml-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe)
79$(cts-combined-xml-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description)
Sam Line50cbf72017-09-26 14:21:33 -070080$(cts-combined-xml-coverage-report): PRIVATE_NAPI_XML_DESC := $(napi_xml_description)
Nicholas Sauer12b986f2016-01-06 10:54:44 -080081$(cts-combined-xml-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP)
Sam Line50cbf72017-09-26 14:21:33 -070082 $(call generate-coverage-report-cts,"CTS Combined API Coverage Report - XML",\
Nicholas Sauer12b986f2016-01-06 10:54:44 -080083 $(PRIVATE_TEST_CASES),xml)
Nicholas Sauer0130e902015-12-23 20:37:15 -080084
Ying Wang50889ab2010-12-01 16:29:54 -080085.PHONY: cts-test-coverage
86cts-test-coverage : $(cts-test-coverage-report)
87
Brian Muramatsu4b32d082010-12-02 13:08:44 -080088.PHONY: cts-verifier-coverage
89cts-verifier-coverage : $(cts-verifier-coverage-report)
90
Keun young Park506ca412012-08-28 10:52:31 -070091.PHONY: cts-combined-coverage
92cts-combined-coverage : $(cts-combined-coverage-report)
93
Nicholas Sauer0130e902015-12-23 20:37:15 -080094.PHONY: cts-combined-xml-coverage
95cts-combined-xml-coverage : $(cts-combined-xml-coverage-report)
96
Ying Wang50889ab2010-12-01 16:29:54 -080097# Put the test coverage report in the dist dir if "cts" is among the build goals.
98ifneq ($(filter cts, $(MAKECMDGOALS)),)
Brian Muramatsu16fdad82010-12-02 17:13:44 -080099 $(call dist-for-goals, cts, $(cts-test-coverage-report):cts-test-coverage-report.html)
100 $(call dist-for-goals, cts, $(cts-verifier-coverage-report):cts-verifier-coverage-report.html)
Keun young Park506ca412012-08-28 10:52:31 -0700101 $(call dist-for-goals, cts, $(cts-combined-coverage-report):cts-combined-coverage-report.html)
Nicholas Sauer0130e902015-12-23 20:37:15 -0800102 $(call dist-for-goals, cts, $(cts-combined-xml-coverage-report):cts-combined-coverage-report.xml)
Ying Wang50889ab2010-12-01 16:29:54 -0800103endif
104
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700105# Arguments;
106# 1 - Name of the report printed out on the screen
Ying Wang1a833732013-07-10 11:29:35 -0700107# 2 - List of apk files that will be scanned to generate the report
108# 3 - Format of the report
Sam Line50cbf72017-09-26 14:21:33 -0700109define generate-coverage-report-cts
Ying Wang697ebf02013-08-01 11:09:25 -0700110 $(hide) mkdir -p $(dir $@)
Sam Line50cbf72017-09-26 14:21:33 -0700111 $(hide) $(PRIVATE_CTS_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -n $(PRIVATE_NAPI_XML_DESC) -f $(3) -o $@ $(2)
112 @ echo $(1): file://$$(cd $(dir $@); pwd)/$(notdir $@)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700113endef
Ying Wang697ebf02013-08-01 11:09:25 -0700114
115# Reset temp vars
116cts_api_coverage_dependencies :=
Ying Wang697ebf02013-08-01 11:09:25 -0700117cts-combined-coverage-report :=
Nicholas Sauer0130e902015-12-23 20:37:15 -0800118cts-combined-xml-coverage-report :=
Ying Wang697ebf02013-08-01 11:09:25 -0700119cts-verifier-coverage-report :=
120cts-test-coverage-report :=
121api_xml_description :=
122api_text_description :=
Sam Line50cbf72017-09-26 14:21:33 -0700123napi_xml_description :=
124napi_text_description :=
Ying Wang697ebf02013-08-01 11:09:25 -0700125coverage_out :=
126dexdeps_exe :=
127cts_api_coverage_exe :=
Nicholas Sauereeb749c2016-01-05 17:42:50 -0800128cts_verifier_apk :=
Nicholas Sauer12b986f2016-01-06 10:54:44 -0800129android_cts_zip :=