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 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 27 | api_text_description := $(SRC_API_DIR)/current.txt |
| 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 | |
| 38 | cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) $(ACP) |
| 39 | |
| 40 | $(cts-test-coverage-report) : $(CTS_COVERAGE_TEST_CASE_LIST) $(cts_api_coverage_dependencies) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 41 | $(call generate-coverage-report,"CTS Tests API Coverage Report",\ |
Brian Muramatsu | 50f888e | 2011-06-30 17:06:13 -0700 | [diff] [blame] | 42 | $(CTS_COVERAGE_TEST_CASE_LIST),cts-test-apks,html,test-coverage.html) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 43 | |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 44 | $(cts-verifier-coverage-report) : CtsVerifier $(cts_api_coverage_dependencies) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 45 | $(call generate-coverage-report,"CTS Verifier API Coverage Report",\ |
Brian Muramatsu | 50f888e | 2011-06-30 17:06:13 -0700 | [diff] [blame] | 46 | CtsVerifier,cts-verifier-apks,html,verifier-coverage.html) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 47 | |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 48 | $(cts-combined-coverage-report) : CtsVerifier $(cts_api_coverage_dependencies) $(CTS_COVERAGE_TEST_CASE_LIST) $(cts_api_coverage_dependencies) |
| 49 | $(call generate-coverage-report,"CTS Combined API Coverage Report",\ |
| 50 | $(CTS_COVERAGE_TEST_CASE_LIST) CtsVerifier,cts-combined-apks,html,combined-coverage.html) |
| 51 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 52 | .PHONY: cts-test-coverage |
| 53 | cts-test-coverage : $(cts-test-coverage-report) |
| 54 | |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 55 | .PHONY: cts-verifier-coverage |
| 56 | cts-verifier-coverage : $(cts-verifier-coverage-report) |
| 57 | |
Keun young Park | 506ca41 | 2012-08-28 10:52:31 -0700 | [diff] [blame] | 58 | .PHONY: cts-combined-coverage |
| 59 | cts-combined-coverage : $(cts-combined-coverage-report) |
| 60 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 61 | # Put the test coverage report in the dist dir if "cts" is among the build goals. |
| 62 | ifneq ($(filter cts, $(MAKECMDGOALS)),) |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 63 | $(call dist-for-goals, cts, $(cts-test-coverage-report):cts-test-coverage-report.html) |
| 64 | $(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] | 65 | $(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] | 66 | endif |
| 67 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 68 | # Arguments; |
| 69 | # 1 - Name of the report printed out on the screen |
| 70 | # 2 - Name of APK packages that will be scanned to generate the report |
Brian Muramatsu | 50f888e | 2011-06-30 17:06:13 -0700 | [diff] [blame] | 71 | # 3 - Name of variable to hold the calculated paths of the APKs |
| 72 | # 4 - Format of the report |
| 73 | # 5 - Output file name of the report |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 74 | define generate-coverage-report |
Brian Muramatsu | 50f888e | 2011-06-30 17:06:13 -0700 | [diff] [blame] | 75 | $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(3),$(testcase)))) |
Brian Muramatsu | 61bd88c | 2011-04-11 13:48:08 -0700 | [diff] [blame] | 76 | $(hide) mkdir -p $(coverage_out) |
Brian Muramatsu | 50f888e | 2011-06-30 17:06:13 -0700 | [diff] [blame] | 77 | $(hide) $(cts_api_coverage_exe) -d $(dexdeps_exe) -a $(api_xml_description) -f $(4) -o $(coverage_out)/$(5) $($(3)) |
| 78 | $(hide) echo $(1): file://$(ANDROID_BUILD_TOP)/$(coverage_out)/$(5) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 79 | endef |
| 80 | |
Ying Wang | 670fe90 | 2011-07-13 16:14:59 -0700 | [diff] [blame] | 81 | # classes.dex is stripped from package.apk if dex-preopt is enabled, |
| 82 | # so we use the copy that definitely includes classes.dex. |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 83 | define add-testcase-apk |
Ying Wang | 670fe90 | 2011-07-13 16:14:59 -0700 | [diff] [blame] | 84 | $(1) += $(call intermediates-dir-for,APPS,$(2))/package.apk.unaligned |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 85 | endef |