blob: 7053fea38f04b732aee90286acf1ea0029a41785 [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
20include cts/CtsTestCaseList.mk
21
Ying Wang50889ab2010-12-01 16:29:54 -080022CTS_API_COVERAGE_EXE := $(HOST_OUT_EXECUTABLES)/cts-api-coverage
Brian Muramatsu4b32d082010-12-02 13:08:44 -080023DEXDEPS_EXE := $(HOST_OUT_EXECUTABLES)/dexdeps
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070024
Brian Muramatsuad5bcd32010-12-06 12:28:22 -080025COVERAGE_OUT := $(HOST_OUT)/cts-api-coverage
Brian Muramatsu16fdad82010-12-02 17:13:44 -080026cts-test-coverage-report := $(COVERAGE_OUT)/test-coverage.html
27cts-verifier-coverage-report := $(COVERAGE_OUT)/verifier-coverage.html
Ying Wang50889ab2010-12-01 16:29:54 -080028
Brian Muramatsu16fdad82010-12-02 17:13:44 -080029CTS_API_COVERAGE_DEPENDENCIES := $(CTS_API_COVERAGE_EXE) $(DEXDEPS_EXE) $(ACP)
Ying Wang50889ab2010-12-01 16:29:54 -080030
31$(cts-test-coverage-report) : $(CTS_COVERAGE_TEST_CASE_LIST) $(CTS_API_COVERAGE_DEPENDENCIES)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070032 $(call generate-coverage-report,"CTS Tests API Coverage Report",\
Brian Muramatsuad5bcd32010-12-06 12:28:22 -080033 $(CTS_COVERAGE_TEST_CASE_LIST),html,test-coverage.html)
Brian Muramatsu4b32d082010-12-02 13:08:44 -080034
35$(cts-verifier-coverage-report) : CtsVerifier $(CTS_API_COVERAGE_DEPENDENCIES)
36 $(call generate-coverage-report,"CTS Verifier API Coverage Report",\
Brian Muramatsuad5bcd32010-12-06 12:28:22 -080037 CtsVerifier,html,verifier-coverage.html)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070038
Ying Wang50889ab2010-12-01 16:29:54 -080039.PHONY: cts-test-coverage
40cts-test-coverage : $(cts-test-coverage-report)
41
Brian Muramatsu4b32d082010-12-02 13:08:44 -080042.PHONY: cts-verifier-coverage
43cts-verifier-coverage : $(cts-verifier-coverage-report)
44
Ying Wang50889ab2010-12-01 16:29:54 -080045# Put the test coverage report in the dist dir if "cts" is among the build goals.
46ifneq ($(filter cts, $(MAKECMDGOALS)),)
Brian Muramatsu16fdad82010-12-02 17:13:44 -080047 $(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 Wang50889ab2010-12-01 16:29:54 -080049endif
50
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070051# 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 Muramatsuad5bcd32010-12-06 12:28:22 -080055# 4 - Output file name of the report
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070056define generate-coverage-report
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070057 $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(testcase))))
Brian Muramatsuad5bcd32010-12-06 12:28:22 -080058 $(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 Muramatsu2f8eead2010-09-24 14:56:43 -070061endef
62
63define add-testcase-apk
64 TEST_APKS += $(call intermediates-dir-for,APPS,$(1))/package.apk
65endef