blob: 66f3b5bf00b4b88dccb4ee4c8762fed996779b0d [file] [log] [blame]
Stuart Scott1926e9b2015-06-03 17:42:39 -07001# Copyright (C) 2015 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# Package up a compatibility test suite in a zip file.
16#
17# Input variables:
18# test_suite_name: the name of this test suite eg. cts
19# test_suite_tradefed: the name of this test suite's tradefed wrapper
Aaron Holdenaee6f602015-12-15 15:04:01 -080020# test_suite_dynamic_config: the path to this test suite's dynamic configuration file
Stuart Scott1926e9b2015-06-03 17:42:39 -070021# test_suite_readme: the path to a README file for this test suite
Todd Leebae7ee52017-06-01 08:00:32 -070022# test_suite_prebuilt_tools: the set of prebuilt tools to be included directly
23# in the 'tools' subdirectory of the test suite.
Siyuan Zhou18883152017-11-20 17:26:40 -080024# test_suite_tools: the set of tools for this test suite
25#
Stuart Scott1926e9b2015-06-03 17:42:39 -070026# Output variables:
27# compatibility_zip: the path to the output zip file.
28
Colin Crossfa4f7202019-09-10 13:27:32 -070029test_suite_subdir := android-$(test_suite_name)
30out_dir := $(HOST_OUT)/$(test_suite_name)/$(test_suite_subdir)
Stuart Scott1926e9b2015-06-03 17:42:39 -070031test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
Julien Desprez8d5158f2020-10-20 13:22:43 -070032test_tools := $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
Julien Desprezb8f37692020-07-09 15:29:37 -070033 $(HOST_OUT_JAVA_LIBRARIES)/tradefed-no-fwk.jar \
Julien Desprezfae54cb2020-05-18 13:28:40 -070034 $(HOST_OUT_JAVA_LIBRARIES)/tradefed-test-framework.jar \
jdesprez46190312018-03-19 16:47:22 -070035 $(HOST_OUT_JAVA_LIBRARIES)/loganalysis.jar \
Stuart Scott19324d12015-07-23 12:56:51 -070036 $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
Julien Desprez7b109502016-09-12 11:19:48 +010037 $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util-tests.jar \
38 $(HOST_OUT_JAVA_LIBRARIES)/compatibility-common-util-tests.jar \
39 $(HOST_OUT_JAVA_LIBRARIES)/compatibility-tradefed-tests.jar \
Stuart Scott1dcff842015-06-08 15:04:31 -070040 $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed).jar \
Julien Desprez7b109502016-09-12 11:19:48 +010041 $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed)-tests.jar \
Stuart Scott1dcff842015-06-08 15:04:31 -070042 $(HOST_OUT_EXECUTABLES)/$(test_suite_tradefed) \
43 $(test_suite_readme)
Stuart Scott1926e9b2015-06-03 17:42:39 -070044
Siyuan Zhou18883152017-11-20 17:26:40 -080045test_tools += $(test_suite_tools)
46
Colin Crossfa4f7202019-09-10 13:27:32 -070047# The JDK to package into the test suite zip file. Always package the linux JDK.
48test_suite_jdk_dir := $(ANDROID_JAVA_HOME)/../linux-x86
49test_suite_jdk := $(call intermediates-dir-for,PACKAGING,$(test_suite_name)_jdk,HOST)/jdk.zip
50$(test_suite_jdk): PRIVATE_JDK_DIR := $(test_suite_jdk_dir)
51$(test_suite_jdk): PRIVATE_SUBDIR := $(test_suite_subdir)
52$(test_suite_jdk): $(shell find $(test_suite_jdk_dir) -type f | sort)
53$(test_suite_jdk): $(SOONG_ZIP)
54 $(SOONG_ZIP) -o $@ -P $(PRIVATE_SUBDIR)/jdk -C $(PRIVATE_JDK_DIR) -D $(PRIVATE_JDK_DIR)
55
Dan Shi6a619b82020-04-13 09:29:16 -070056# Include host shared libraries
57host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES))
58
Colin Crossfa4f7202019-09-10 13:27:32 -070059compatibility_zip_deps := \
60 $(test_artifacts) \
61 $(test_tools) \
62 $(test_suite_prebuilt_tools) \
63 $(test_suite_dynamic_config) \
64 $(test_suite_jdk) \
65 $(MERGE_ZIPS) \
66 $(SOONG_ZIP) \
67 $(host_shared_libs) \
68
wangzhoue7f17252020-07-15 07:49:26 -070069compatibility_zip_resources := $(out_dir)/tools $(out_dir)/testcases
wangzhou23acb0b2020-07-21 17:18:01 -070070
71# Test Suite NOTICE files
72test_suite_notice_txt := $(out_dir)/NOTICE.txt
73test_suite_notice_html := $(out_dir)/NOTICE.html
74
75$(eval $(call combine-notice-files, html, \
76 $(test_suite_notice_txt), \
77 $(test_suite_notice_html), \
78 "Notices for files contained in the test suites filesystem image in this directory:", \
79 $(HOST_OUT_NOTICE_FILES) $(TARGET_OUT_NOTICE_FILES), \
80 $(compatibility_zip_deps)))
81
Dan Shi413a5302020-10-22 15:36:21 -070082compatibility_zip_deps += $(test_suite_notice_txt)
83compatibility_zip_resources += $(test_suite_notice_txt)
wangzhoue7f17252020-07-15 07:49:26 -070084
Stuart Scott1926e9b2015-06-03 17:42:39 -070085compatibility_zip := $(out_dir).zip
Stuart Scott1926e9b2015-06-03 17:42:39 -070086$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
Todd Leebae7ee52017-06-01 08:00:32 -070087$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
Aaron Holdenaee6f602015-12-15 15:04:01 -080088$(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name)
89$(compatibility_zip): PRIVATE_DYNAMIC_CONFIG := $(test_suite_dynamic_config)
wangzhoue7f17252020-07-15 07:49:26 -070090$(compatibility_zip): PRIVATE_RESOURCES := $(compatibility_zip_resources)
Colin Crossfa4f7202019-09-10 13:27:32 -070091$(compatibility_zip): PRIVATE_JDK := $(test_suite_jdk)
wangzhoue7f17252020-07-15 07:49:26 -070092$(compatibility_zip): $(compatibility_zip_deps) | $(ADB) $(ACP)
Stuart Scott1926e9b2015-06-03 17:42:39 -070093# Make dir structure
Colin Crossfa4f7202019-09-10 13:27:32 -070094 mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
95 rm -f $@ $@.tmp $@.jdk
96 echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt
Stuart Scott1926e9b2015-06-03 17:42:39 -070097# Copy tools
Colin Crossfa4f7202019-09-10 13:27:32 -070098 cp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
Dan Willemsen288bedf2019-05-28 15:36:47 -070099 $(if $(PRIVATE_DYNAMIC_CONFIG),$(hide) cp $(PRIVATE_DYNAMIC_CONFIG) $(PRIVATE_OUT_DIR)/testcases/$(PRIVATE_SUITE_NAME).dynamic)
Colin Crossfa4f7202019-09-10 13:27:32 -0700100 find $(PRIVATE_RESOURCES) | sort >$@.list
101 $(SOONG_ZIP) -d -o $@.tmp -C $(dir $@) -l $@.list
102 $(MERGE_ZIPS) $@ $@.tmp $(PRIVATE_JDK)
103 rm -f $@.tmp
Aaron Holdenaee6f602015-12-15 15:04:01 -0800104
105# Reset all input variables
106test_suite_name :=
107test_suite_tradefed :=
108test_suite_dynamic_config :=
109test_suite_readme :=
Todd Leebae7ee52017-06-01 08:00:32 -0700110test_suite_prebuilt_tools :=
Siyuan Zhou18883152017-11-20 17:26:40 -0800111test_suite_tools :=
Colin Crossfa4f7202019-09-10 13:27:32 -0700112test_suite_jdk :=
113test_suite_jdk_dir :=
Dan Shi6a619b82020-04-13 09:29:16 -0700114host_shared_libs :=