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 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 22 | CTS_API_COVERAGE_EXE := $(HOST_OUT_EXECUTABLES)/cts-api-coverage |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 23 | DEXDEPS_EXE := $(HOST_OUT_EXECUTABLES)/dexdeps |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 24 | |
Brian Muramatsu | ad5bcd3 | 2010-12-06 12:28:22 -0800 | [diff] [blame] | 25 | COVERAGE_OUT := $(HOST_OUT)/cts-api-coverage |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 26 | cts-test-coverage-report := $(COVERAGE_OUT)/test-coverage.html |
| 27 | cts-verifier-coverage-report := $(COVERAGE_OUT)/verifier-coverage.html |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 28 | |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 29 | CTS_API_COVERAGE_DEPENDENCIES := $(CTS_API_COVERAGE_EXE) $(DEXDEPS_EXE) $(ACP) |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 30 | |
| 31 | $(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] | 32 | $(call generate-coverage-report,"CTS Tests API Coverage Report",\ |
Brian Muramatsu | ad5bcd3 | 2010-12-06 12:28:22 -0800 | [diff] [blame] | 33 | $(CTS_COVERAGE_TEST_CASE_LIST),html,test-coverage.html) |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 34 | |
| 35 | $(cts-verifier-coverage-report) : CtsVerifier $(CTS_API_COVERAGE_DEPENDENCIES) |
| 36 | $(call generate-coverage-report,"CTS Verifier API Coverage Report",\ |
Brian Muramatsu | ad5bcd3 | 2010-12-06 12:28:22 -0800 | [diff] [blame] | 37 | CtsVerifier,html,verifier-coverage.html) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 38 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 39 | .PHONY: cts-test-coverage |
| 40 | cts-test-coverage : $(cts-test-coverage-report) |
| 41 | |
Brian Muramatsu | 4b32d08 | 2010-12-02 13:08:44 -0800 | [diff] [blame] | 42 | .PHONY: cts-verifier-coverage |
| 43 | cts-verifier-coverage : $(cts-verifier-coverage-report) |
| 44 | |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 45 | # Put the test coverage report in the dist dir if "cts" is among the build goals. |
| 46 | ifneq ($(filter cts, $(MAKECMDGOALS)),) |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 47 | $(call dist-for-goals, cts, $(cts-test-coverage-report):cts-test-coverage-report.html) |
| 48 | $(call dist-for-goals, cts, $(cts-verifier-coverage-report):cts-verifier-coverage-report.html) |
Ying Wang | 50889ab | 2010-12-01 16:29:54 -0800 | [diff] [blame] | 49 | endif |
| 50 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 51 | # Arguments; |
| 52 | # 1 - Name of the report printed out on the screen |
| 53 | # 2 - Name of APK packages that will be scanned to generate the report |
| 54 | # 3 - Format of the report |
Brian Muramatsu | ad5bcd3 | 2010-12-06 12:28:22 -0800 | [diff] [blame] | 55 | # 4 - Output file name of the report |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 56 | define generate-coverage-report |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 57 | $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(testcase)))) |
Brian Muramatsu | ad5bcd3 | 2010-12-06 12:28:22 -0800 | [diff] [blame] | 58 | $(hide) mkdir -p $(COVERAGE_OUT) |
| 59 | $(hide) $(CTS_API_COVERAGE_EXE) -d $(DEXDEPS_EXE) -f $(3) -o $(COVERAGE_OUT)/$(4) $(TEST_APKS) |
| 60 | $(hide) echo $(1): file://$(ANDROID_BUILD_TOP)/$(COVERAGE_OUT)/$(4) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 61 | endef |
| 62 | |
| 63 | define add-testcase-apk |
| 64 | TEST_APKS += $(call intermediates-dir-for,APPS,$(1))/package.apk |
| 65 | endef |