1#
2# Copyright (C) 2018 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
17LOCAL_PATH := $(call my-dir)
18VTF_MK := $(LOCAL_PATH)/vtf.mk
19VTF_PACKAGE_MK := test/vts/tools/build/tasks/framework/vtf_package.mk
20
21include $(CLEAR_VARS)
22include $(LOCAL_PATH)/tasks/list/vtslab_apk_package_list.mk
23include $(LOCAL_PATH)/tasks/list/vtslab_bin_package_list.mk
24include $(LOCAL_PATH)/tasks/list/vtslab_lib_package_list.mk
25
26VTSLAB_OUT_ROOT := $(HOST_OUT)/vtslab
27VTSLAB_TESTCASES_OUT := $(VTSLAB_OUT_ROOT)/android-vtslab/testcases
28VTSLAB_TOOLS_OUT := $(VTSLAB_OUT_ROOT)/android-vtslab/tools
29VTSLAB_BIN_LIB_OUT := $(VTSLAB_OUT_ROOT)/android-vtslab/
30VTSLAB_TIMESTAMP := $(shell git -C $(LOCAL_PATH) log -s -n 1 --format="%cd" \
31  --date=format:"%Y%m%d_%H%M%S" 2>/dev/null)
32VTSLAB_SHORTHASH := $(shell git -C $(LOCAL_PATH) rev-parse --short HEAD 2>/dev/null)
33VTSLAB_VERSION := $(VTSLAB_TIMESTAMP):$(VTSLAB_SHORTHASH)
34
35# Packaging rule for android-vtslab.zip
36test_suite_name := vtslab
37test_suite_readme := test/framework/README.md
38
39include $(LOCAL_PATH)/package.mk
40include $(LOCAL_PATH)/utils/vtslab_package_utils.mk
41
42# TODO: instead of an alias, deprecate vtslab build target
43.PHONY: lab
44lab: vtslab
45.PHONY: vtslab
46vtslab: $(compatibility_zip)
47$(call dist-for-goals, vtslab, $(compatibility_zip))
48
49# Packaging rule for android-vtslab.zip's testcases dir (DATA subdir).
50vtslab_apk_modules := \
51  $(vtslab_apk_packages) \
52
53vtslab_apk_modules_copy_pairs := \
54  $(call target-native-copy-pairs,$(vtslab_apk_modules),$(VTSLAB_TESTCASES_OUT))
55
56# host controller files.
57host_hc_files := \
58  $(call find-files-in-subdirs,test/framework/harnesses/host_controller,"*.py" -and -type f,.) \
59
60host_hc_copy_pairs := \
61  $(foreach f,$(host_hc_files),\
62      test/framework/harnesses/host_controller/$(f):$(VTSLAB_TESTCASES_OUT)/host_controller/$(f))
63
64# gsi security patch scripts.
65host_hc_gsispl_files := \
66  $(call find-files-in-subdirs,test/framework/harnesses/host_controller/gsi,"*.sh" -and -type f,.) \
67
68host_hc_gsispl_copy_pairs := \
69  $(foreach f,$(host_hc_gsispl_files),\
70    test/framework/harnesses/host_controller/gsi/$(f):$(VTSLAB_BIN_LIB_OUT)/bin/$(f))
71
72# host controller scripts.
73host_hc_extra_copy_pairs := \
74  test/framework/tools/host_controller/run:$(VTSLAB_TOOLS_OUT)/run \
75  test/framework/tools/host_controller/make_screen:$(VTSLAB_TOOLS_OUT)/make_screen \
76  test/vts/script/diagnose.py:$(VTSLAB_BIN_LIB_OUT)/bin/diagnose.py \
77  test/vts/script/pip_requirements.txt:$(VTSLAB_BIN_LIB_OUT)/bin/pip_requirements.txt \
78  test/vts/script/setup.sh:$(VTSLAB_BIN_LIB_OUT)/bin/setup.sh \
79
80host_acloud_files := \
81  $(call find-files-in-subdirs,tools/acloud,"*.py" -and -type f,.) \
82  $(call find-files-in-subdirs,tools/acloud,"*.config" -and -type f,.)
83
84host_acloud_copy_pairs := \
85  $(foreach f,$(host_acloud_files),\
86    tools/acloud/$(f):$(VTSLAB_TESTCASES_OUT)/acloud/$(f))
87
88host_vti_dashboard_proto_files := \
89  $(call find-files-in-subdirs,test/vti/dashboard/proto,"*.py" -and -type f,.)
90
91host_vti_test_serving_proto_files := \
92  $(call find-files-in-subdirs,test/vti/test_serving/proto,"*.py" -and -type f,.)
93
94host_vti_copy_pairs := \
95  $(foreach f,$(host_vti_test_serving_proto_files),\
96    test/vti/test_serving/proto/$(f):$(VTSLAB_TESTCASES_OUT)/vti/test_serving/proto/$(f)) \
97  $(foreach f,$(host_vti_dashboard_proto_files),\
98    test/vti/dashboard/proto/$(f):$(VTSLAB_TESTCASES_OUT)/vti/dashboard/proto/$(f)) \
99  test/vti/dashboard/__init__.py:$(VTSLAB_TESTCASES_OUT)/vti/dashboard/__init__.py \
100  test/vti/test_serving/__init__.py:$(VTSLAB_TESTCASES_OUT)/vti/test_serving/__init__.py \
101
102$(VTSLAB_TESTCASES_OUT)/vti/__init__.py:
103	@mkdir -p $(VTSLAB_TESTCASES_OUT)/vti
104	@touch $(VTSLAB_TESTCASES_OUT)/vti/__init__.py
105
106host_vti_extra_copy_pairs := \
107  $(VTSLAB_TESTCASES_OUT)/vti/__init__.py \
108
109vts_host_python_files := \
110  $(call find-files-in-subdirs,test/vts,"*.py" -and -type f,.)
111
112vts_host_python_copy_pairs := \
113  $(foreach f,$(vts_host_python_files),\
114    test/vts/$(f):$(VTSLAB_TESTCASES_OUT)/vts/$(f))
115
116# Packaging rule for host-controller's dependencies
117host_hc_bin_lib := \
118  $(vtslab_bin_packages) \
119  $(vtslab_lib_packages) \
120
121host_hc_bin_lib_copy_pairs := \
122  $(call host-native-copy-pairs,$(host_hc_bin_lib),$(VTSLAB_BIN_LIB_OUT))
123
124vtslab_copy_pairs := \
125  $(call copy-many-files,$(vtslab_apk_modules_copy_pairs)) \
126  $(call copy-many-files,$(host_hc_copy_pairs)) \
127  $(call copy-many-files,$(host_hc_gsispl_copy_pairs)) \
128  $(call copy-many-files,$(host_hc_extra_copy_pairs)) \
129  $(call copy-many-files,$(host_acloud_copy_pairs)) \
130  $(call copy-many-files,$(host_vti_copy_pairs)) \
131  $(call copy-many-files,$(vts_host_python_copy_pairs)) \
132  $(call copy-many-files,$(host_hc_bin_lib_copy_pairs)) \
133  $(host_vti_extra_copy_pairs) \
134
135$(compatibility_zip): $(vtslab_copy_pairs) $(VTSLAB_TESTCASES_OUT)/version.txt
136
137$(VTSLAB_TESTCASES_OUT)/version.txt:
138	@rm -f $@
139	@echo $(VTSLAB_VERSION) > $@
140
141# for VTF (Vendor Test Framework)
142VTF_OUT_ROOT := $(HOST_OUT)/vtf
143VTF_TESTCASES_OUT := $(VTF_OUT_ROOT)/android-vtf/testcases
144VTF_TOOLS_OUT := $(VTF_OUT_ROOT)/android-vtf/tools
145VTF_EXTRA_SCRIPTS := vtf
146
147include $(VTF_PACKAGE_MK)
148include $(VTF_MK)
149
150# clears local vars
151VTF_MK :=
152VTF_PACKAGE_MK :=
153