• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15.PHONY: general-tests
16
17general_tests_tools := \
18    $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \
19    $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
20    $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed.jar \
21
22intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests)
23general_tests_zip := $(PRODUCT_OUT)/general-tests.zip
24# Create an artifact to include a list of test config files in general-tests.
25general_tests_list_zip := $(PRODUCT_OUT)/general-tests_list.zip
26
27# Filter shared entries between general-tests and device-tests's HOST_SHARED_LIBRARY.FILES,
28# to avoid warning about overriding commands.
29my_host_shared_lib_for_general_tests := \
30  $(foreach m,$(filter $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
31	   $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES)),$(call word-colon,2,$(m)))
32my_general_tests_shared_lib_files := \
33  $(filter-out $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
34	 $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES))
35
36my_host_shared_lib_for_general_tests += $(call copy-many-files,$(my_general_tests_shared_lib_files))
37
38# Create an artifact to include all test config files in general-tests.
39general_tests_configs_zip := $(PRODUCT_OUT)/general-tests_configs.zip
40# Create an artifact to include all shared librariy files in general-tests.
41general_tests_host_shared_libs_zip := $(PRODUCT_OUT)/general-tests_host-shared-libs.zip
42
43# Copy kernel test modules to testcases directories
44include $(BUILD_SYSTEM)/tasks/tools/vts-kernel-tests.mk
45kernel_test_copy_pairs := \
46  $(call target-native-copy-pairs,$(kernel_test_modules),$(kernel_test_host_out))
47copy_kernel_tests := $(call copy-many-files,$(kernel_test_copy_pairs))
48
49# PHONY target to be used to build and test `vts_kernel_tests` without building full vts
50.PHONY: vts_kernel_tests
51vts_kernel_tests: $(copy_kernel_tests)
52
53$(general_tests_zip) : $(copy_kernel_tests)
54$(general_tests_zip) : PRIVATE_KERNEL_TEST_HOST_OUT := $(kernel_test_host_out)
55$(general_tests_zip) : PRIVATE_general_tests_list_zip := $(general_tests_list_zip)
56$(general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip)
57$(general_tests_zip) : PRIVATE_TOOLS := $(general_tests_tools)
58$(general_tests_zip) : PRIVATE_INTERMEDIATES_DIR := $(intermediates_dir)
59$(general_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_general_tests)
60$(general_tests_zip) : PRIVATE_general_tests_configs_zip := $(general_tests_configs_zip)
61$(general_tests_zip) : PRIVATE_general_host_shared_libs_zip := $(general_tests_host_shared_libs_zip)
62$(general_tests_zip) : $(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(my_host_shared_lib_for_general_tests) $(SOONG_ZIP)
63	rm -rf $(PRIVATE_INTERMEDIATES_DIR)
64	rm -f $@ $(PRIVATE_general_tests_list_zip)
65	mkdir -p $(PRIVATE_INTERMEDIATES_DIR) $(PRIVATE_INTERMEDIATES_DIR)/tools
66	echo $(sort $(COMPATIBILITY.general-tests.FILES)) | tr " " "\n" > $(PRIVATE_INTERMEDIATES_DIR)/list
67	find $(PRIVATE_KERNEL_TEST_HOST_OUT) >> $(PRIVATE_INTERMEDIATES_DIR)/list
68	grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/host.list || true
69	grep $(TARGET_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/target.list || true
70	grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list > $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list || true
71	grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list > $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list || true
72	$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
73	  echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/host.list; \
74	  echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \
75	done
76	grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true
77	cp -fp $(PRIVATE_TOOLS) $(PRIVATE_INTERMEDIATES_DIR)/tools/
78	$(SOONG_ZIP) -d -o $@ \
79	  -P host -C $(PRIVATE_INTERMEDIATES_DIR) -D $(PRIVATE_INTERMEDIATES_DIR)/tools \
80	  -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host.list \
81	  -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target.list
82	$(SOONG_ZIP) -d -o $(PRIVATE_general_tests_configs_zip) \
83	  -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list \
84	  -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list
85	$(SOONG_ZIP) -d -o $(PRIVATE_general_host_shared_libs_zip) \
86	  -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list
87	grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
88	grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
89	$(SOONG_ZIP) -d -o $(PRIVATE_general_tests_list_zip) -C $(PRIVATE_INTERMEDIATES_DIR) -f $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
90
91general-tests: $(general_tests_zip)
92$(call dist-for-goals, general-tests, $(general_tests_zip) $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip))
93
94$(call declare-1p-container,$(general_tests_zip),)
95$(call declare-container-license-deps,$(general_tests_zip),$(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(my_host_shared_lib_for_general_tests),$(PRODUCT_OUT)/:/)
96
97intermediates_dir :=
98general_tests_tools :=
99general_tests_zip :=
100general_tests_list_zip :=
101general_tests_configs_zip :=
102general_tests_host_shared_libs_zip :=
103