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 | |
| 20 | include cts/CtsTestCaseList.mk |
| 21 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 22 | cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage |
| 23 | dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 24 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 25 | coverage_out := $(HOST_OUT)/cts-api-coverage |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 26 | |
Ying Wang | d97c2b1 | 2012-10-05 16:43:21 -0700 | [diff] [blame] | 27 | api_text_description := frameworks/base/api/current.txt |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 28 | api_xml_description := $(coverage_out)/api.xml |
| 29 | $(api_xml_description) : $(api_text_description) $(APICHECK) |
| 30 | $(hide) echo "Converting API file to XML: $@" |
| 31 | $(hide) mkdir -p $(coverage_out) |
| 32 | $(hide) $(APICHECK_COMMAND) -convert2xml $(api_text_description) $(api_xml_description) |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 33 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 34 | cts-test-coverage-report := $(coverage_out)/test-coverage.html |
| 35 | cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 36 | cts-combined-coverage-report := $(coverage_out)/combined-coverage.html |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 37 | |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 38 | 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] | 39 | |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 40 | cts_coverage_test_cases_dependencies := $(foreach c, $(CTS_COVERAGE_TEST_CASE_LIST), $(call intermediates-dir-for,APPS,$(c))/package.apk) |
| 41 | $(cts-test-coverage-report) : PRIVATE_TEST_CASES_APKS := $(cts_coverage_test_cases_dependencies) |
| 42 | $(cts-test-coverage-report) : $(cts_coverage_test_cases_dependencies) $(cts_api_coverage_dependencies) | $(ACP) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 43 | $(call generate-coverage-report,"CTS Tests API Coverage Report",\ |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 44 | $(PRIVATE_TEST_CASES_APKS),html,test-coverage.html) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 45 | |
Ying Wang | d1ea6cc | 2013-07-10 13:40:48 -0700 | [diff] [blame] | 46 | cts_coverage_test_cases_dependencies := $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 47 | $(cts-test-coverage-report) : PRIVATE_TEST_CASES_APKS := $(cts_coverage_test_cases_dependencies) |
| 48 | $(cts-verifier-coverage-report) : $(cts_coverage_test_cases_dependencies) $(cts_api_coverage_dependencies) | $(ACP) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 49 | $(call generate-coverage-report,"CTS Verifier API Coverage Report",\ |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 50 | $(PRIVATE_TEST_CASES_APKS),html,verifier-coverage.html) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 51 | |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 52 | cts_coverage_test_cases_dependencies := $(foreach c, $(CTS_COVERAGE_TEST_CASE_LIST) CtsVerifier, $(call intermediates-dir-for,APPS,$(c))/package.apk) |
| 53 | $(cts-test-coverage-report) : PRIVATE_TEST_CASES_APKS := $(cts_coverage_test_cases_dependencies) |
| 54 | $(cts-combined-coverage-report) : $(cts_coverage_test_cases_dependencies) $(cts_api_coverage_dependencies) | $(ACP) |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 55 | $(call generate-coverage-report,"CTS Combined API Coverage Report",\ |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 56 | $(PRIVATE_TEST_CASES_APKS),html,combined-coverage.html) |
| 57 | |
| 58 | cts_api_coverage_dependencies := |
| 59 | cts_coverage_test_cases_dependencies := |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 60 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 61 | .PHONY: cts-test-coverage |
| 62 | cts-test-coverage : $(cts-test-coverage-report) |
| 63 | |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 64 | .PHONY: cts-verifier-coverage |
| 65 | cts-verifier-coverage : $(cts-verifier-coverage-report) |
| 66 | |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 67 | .PHONY: cts-combined-coverage |
| 68 | cts-combined-coverage : $(cts-combined-coverage-report) |
| 69 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 70 | # Put the test coverage report in the dist dir if "cts" is among the build goals. |
| 71 | ifneq ($(filter cts, $(MAKECMDGOALS)),) |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 72 | $(call dist-for-goals, cts, $(cts-test-coverage-report):cts-test-coverage-report.html) |
| 73 | $(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] | 74 | $(call dist-for-goals, cts, $(cts-combined-coverage-report):cts-combined-coverage-report.html) |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 75 | endif |
| 76 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 77 | # Arguments; |
| 78 | # 1 - Name of the report printed out on the screen |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 79 | # 2 - List of apk files that will be scanned to generate the report |
| 80 | # 3 - Format of the report |
| 81 | # 4 - Output file name of the report |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 82 | define generate-coverage-report |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 83 | $(hide) mkdir -p $(coverage_out) |
Ying Wang | 1a83373 | 2013-07-10 11:29:35 -0700 | [diff] [blame] | 84 | $(hide) $(cts_api_coverage_exe) -d $(dexdeps_exe) -a $(api_xml_description) -f $(3) -o $(coverage_out)/$(4) $(2) |
| 85 | @ echo $(1): file://$(ANDROID_BUILD_TOP)/$(coverage_out)/$(4) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 86 | endef |