blob: 3d305549b466eec12de6786c4f72613caedfb880 [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 Muramatsu4b32d082010-12-02 13:08:44 -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 Muramatsu16fdad82010-12-02 17:13:44 -080033 $(CTS_COVERAGE_TEST_CASE_LIST),html,$(HOST_OUT)/cts/api-coverage,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 Muramatsu16fdad82010-12-02 17:13:44 -080037 CtsVerifier,html,$(HOST_OUT)/cts/api-coverage,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
55# 4 - Output directory to put the report
56# 5 - Output file name of the report
57define generate-coverage-report
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070058 $(hide) mkdir -p $(4)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070059
60 $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(testcase))))
Brian Muramatsu4b32d082010-12-02 13:08:44 -080061 $(hide) $(CTS_API_COVERAGE_EXE) -d $(DEXDEPS_EXE) -f $(3) -o $(4)/$(5) $(TEST_APKS)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070062
63 @echo $(1): file://$(ANDROID_BUILD_TOP)/$(4)/$(5)
64endef
65
66define add-testcase-apk
67 TEST_APKS += $(call intermediates-dir-for,APPS,$(1))/package.apk
68endef