Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 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 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 20 | cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage |
| 21 | dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 22 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 23 | coverage_out := $(HOST_OUT)/cts-api-coverage |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 24 | |
Ying Wang | d97c2b1 | 2012-10-05 16:43:21 -0700 | [diff] [blame] | 25 | api_text_description := frameworks/base/api/current.txt |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 26 | api_xml_description := $(coverage_out)/api.xml |
| 27 | $(api_xml_description) : $(api_text_description) $(APICHECK) |
| 28 | $(hide) echo "Converting API file to XML: $@" |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 29 | $(hide) mkdir -p $(dir $@) |
| 30 | $(hide) $(APICHECK_COMMAND) -convert2xml $< $@ |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 31 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 32 | cts-test-coverage-report := $(coverage_out)/test-coverage.html |
| 33 | cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 34 | cts-combined-coverage-report := $(coverage_out)/combined-coverage.html |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 35 | cts-combined-xml-coverage-report := $(coverage_out)/combined-coverage.xml |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 36 | |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 37 | cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 38 | |
Nicholas Sauer | 3a2cc27 | 2016-08-12 07:56:00 -0700 | [diff] [blame] | 39 | android_cts_zip := $(HOST_OUT)/cts/android-cts.zip |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 40 | cts_verifier_apk := $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk |
| 41 | |
Nicholas Sauer | 3a2cc27 | 2016-08-12 07:56:00 -0700 | [diff] [blame] | 42 | $(cts-test-coverage-report): PRIVATE_TEST_CASES := $(COMPATIBILITY_TESTCASES_OUT_cts) |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 43 | $(cts-test-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) |
| 44 | $(cts-test-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) |
| 45 | $(cts-test-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 46 | $(cts-test-coverage-report) : $(android_cts_zip) $(cts_api_coverage_dependencies) | $(ACP) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 47 | $(call generate-coverage-report,"CTS Tests API Coverage Report",\ |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 48 | $(PRIVATE_TEST_CASES),html) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 49 | |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 50 | $(cts-verifier-coverage-report): PRIVATE_TEST_CASES := $(cts_verifier_apk) |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 51 | $(cts-verifier-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) |
| 52 | $(cts-verifier-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) |
| 53 | $(cts-verifier-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 54 | $(cts-verifier-coverage-report) : $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 55 | $(call generate-coverage-report,"CTS Verifier API Coverage Report",\ |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 56 | $(PRIVATE_TEST_CASES),html) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 57 | |
Nicholas Sauer | 3a2cc27 | 2016-08-12 07:56:00 -0700 | [diff] [blame] | 58 | $(cts-combined-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c)) |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 59 | $(cts-combined-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) |
| 60 | $(cts-combined-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) |
| 61 | $(cts-combined-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 62 | $(cts-combined-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 63 | $(call generate-coverage-report,"CTS Combined API Coverage Report",\ |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 64 | $(PRIVATE_TEST_CASES),html) |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 65 | |
Nicholas Sauer | 3a2cc27 | 2016-08-12 07:56:00 -0700 | [diff] [blame] | 66 | $(cts-combined-xml-coverage-report): PRIVATE_TEST_CASES := $(foreach c, $(cts_verifier_apk) $(COMPATIBILITY_TESTCASES_OUT_cts), $(c)) |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 67 | $(cts-combined-xml-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) |
| 68 | $(cts-combined-xml-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) |
| 69 | $(cts-combined-xml-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 70 | $(cts-combined-xml-coverage-report) : $(android_cts_zip) $(cts_verifier_apk) $(cts_api_coverage_dependencies) | $(ACP) |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 71 | $(call generate-coverage-report,"CTS Combined API Coverage Report - XML",\ |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 72 | $(PRIVATE_TEST_CASES),xml) |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 73 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 74 | .PHONY: cts-test-coverage |
| 75 | cts-test-coverage : $(cts-test-coverage-report) |
| 76 | |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 77 | .PHONY: cts-verifier-coverage |
| 78 | cts-verifier-coverage : $(cts-verifier-coverage-report) |
| 79 | |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 80 | .PHONY: cts-combined-coverage |
| 81 | cts-combined-coverage : $(cts-combined-coverage-report) |
| 82 | |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 83 | .PHONY: cts-combined-xml-coverage |
| 84 | cts-combined-xml-coverage : $(cts-combined-xml-coverage-report) |
| 85 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 86 | # Put the test coverage report in the dist dir if "cts" is among the build goals. |
| 87 | ifneq ($(filter cts, $(MAKECMDGOALS)),) |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 88 | $(call dist-for-goals, cts, $(cts-test-coverage-report):cts-test-coverage-report.html) |
| 89 | $(call dist-for-goals, cts, $(cts-verifier-coverage-report):cts-verifier-coverage-report.html) |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 90 | $(call dist-for-goals, cts, $(cts-combined-coverage-report):cts-combined-coverage-report.html) |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 91 | $(call dist-for-goals, cts, $(cts-combined-xml-coverage-report):cts-combined-coverage-report.xml) |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 92 | endif |
| 93 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 94 | # Arguments; |
| 95 | # 1 - Name of the report printed out on the screen |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 96 | # 2 - List of apk files that will be scanned to generate the report |
| 97 | # 3 - Format of the report |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 98 | define generate-coverage-report |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 99 | $(hide) mkdir -p $(dir $@) |
| 100 | $(hide) $(PRIVATE_CTS_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -f $(3) -o $@ $(2) |
| 101 | @ echo $(1): file://$(ANDROID_BUILD_TOP)/$@ |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 102 | endef |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 103 | |
| 104 | # Reset temp vars |
| 105 | cts_api_coverage_dependencies := |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 106 | cts-combined-coverage-report := |
Nicholas Sauer | 0130e90 | 2015-12-23 20:37:15 -0800 | [diff] [blame] | 107 | cts-combined-xml-coverage-report := |
Ying Wang | 697ebf0 | 2013-08-01 11:09:25 -0700 | [diff] [blame] | 108 | cts-verifier-coverage-report := |
| 109 | cts-test-coverage-report := |
| 110 | api_xml_description := |
| 111 | api_text_description := |
| 112 | coverage_out := |
| 113 | dexdeps_exe := |
| 114 | cts_api_coverage_exe := |
Nicholas Sauer | eeb749c | 2016-01-05 17:42:50 -0800 | [diff] [blame] | 115 | cts_verifier_apk := |
Nicholas Sauer | 12b986f | 2016-01-06 10:54:44 -0800 | [diff] [blame] | 116 | android_cts_zip := |