Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 1 | # 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 Holden | aee6f60 | 2015-12-15 15:04:01 -0800 | [diff] [blame] | 20 | # test_suite_dynamic_config: the path to this test suite's dynamic configuration file |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 21 | # test_suite_readme: the path to a README file for this test suite |
Todd Lee | bae7ee5 | 2017-06-01 08:00:32 -0700 | [diff] [blame] | 22 | # test_suite_prebuilt_tools: the set of prebuilt tools to be included directly |
| 23 | # in the 'tools' subdirectory of the test suite. |
Siyuan Zhou | 1888315 | 2017-11-20 17:26:40 -0800 | [diff] [blame] | 24 | # test_suite_tools: the set of tools for this test suite |
| 25 | # |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 26 | # Output variables: |
| 27 | # compatibility_zip: the path to the output zip file. |
| 28 | |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 29 | test_suite_subdir := android-$(test_suite_name) |
| 30 | out_dir := $(HOST_OUT)/$(test_suite_name)/$(test_suite_subdir) |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 31 | test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES) |
Julien Desprez | 8d5158f | 2020-10-20 13:22:43 -0700 | [diff] [blame] | 32 | test_tools := $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \ |
Julien Desprez | b8f3769 | 2020-07-09 15:29:37 -0700 | [diff] [blame] | 33 | $(HOST_OUT_JAVA_LIBRARIES)/tradefed-no-fwk.jar \ |
Julien Desprez | fae54cb | 2020-05-18 13:28:40 -0700 | [diff] [blame] | 34 | $(HOST_OUT_JAVA_LIBRARIES)/tradefed-test-framework.jar \ |
jdesprez | 4619031 | 2018-03-19 16:47:22 -0700 | [diff] [blame] | 35 | $(HOST_OUT_JAVA_LIBRARIES)/loganalysis.jar \ |
Stuart Scott | 19324d1 | 2015-07-23 12:56:51 -0700 | [diff] [blame] | 36 | $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \ |
Julien Desprez | 67e5ec6 | 2020-11-24 13:20:04 -0800 | [diff] [blame] | 37 | $(HOST_OUT_JAVA_LIBRARIES)/compatibility-tradefed.jar \ |
Stuart Scott | 1dcff84 | 2015-06-08 15:04:31 -0700 | [diff] [blame] | 38 | $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed).jar \ |
Julien Desprez | 7b10950 | 2016-09-12 11:19:48 +0100 | [diff] [blame] | 39 | $(HOST_OUT_JAVA_LIBRARIES)/$(test_suite_tradefed)-tests.jar \ |
Stuart Scott | 1dcff84 | 2015-06-08 15:04:31 -0700 | [diff] [blame] | 40 | $(HOST_OUT_EXECUTABLES)/$(test_suite_tradefed) \ |
| 41 | $(test_suite_readme) |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 42 | |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 43 | $(foreach f,$(test_suite_readme),$(if $(strip $(ALL_TARGETS.$(f).META_LIC)),,$(eval ALL_TARGETS.$(f).META_LIC := $(module_license_metadata)))) |
| 44 | |
Siyuan Zhou | 1888315 | 2017-11-20 17:26:40 -0800 | [diff] [blame] | 45 | test_tools += $(test_suite_tools) |
| 46 | |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 47 | # The JDK to package into the test suite zip file. Always package the linux JDK. |
| 48 | test_suite_jdk_dir := $(ANDROID_JAVA_HOME)/../linux-x86 |
| 49 | test_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 | |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 56 | $(call declare-license-metadata,$(test_suite_jdk),SPDX-license-identifier-GPL-2.0-with-classpath-exception,restricted,\ |
| 57 | $(test_suite_jdk_dir)/legal/java.base/LICENSE,JDK,prebuilts/jdk/$(notdir $(patsubst %/,%,$(dir $(test_suite_jdk_dir))))) |
| 58 | |
Yihan Dong | 9b75c9e | 2022-09-07 11:15:01 +0800 | [diff] [blame^] | 59 | # Copy license metadata |
| 60 | $(call declare-copy-target-license-metadata,$(out_dir)/$(notdir $(test_suite_jdk)),$(test_suite_jdk)) |
| 61 | $(foreach t,$(test_tools) $(test_suite_prebuilt_tools),\ |
| 62 | $(eval _dst := $(out_dir)/tools/$(notdir $(t)))\ |
| 63 | $(if $(strip $(ALL_TARGETS.$(t).META_LIC)),\ |
| 64 | $(call declare-copy-target-license-metadata,$(_dst),$(t)),\ |
| 65 | $(warning $(t) has no license metadata)\ |
| 66 | )\ |
| 67 | ) |
| 68 | test_copied_tools := $(foreach t,$(test_tools) $(test_suite_prebuilt_tools), $(out_dir)/tools/$(notdir $(t))) $(out_dir)/$(notdir $(test_suite_jdk)) |
| 69 | |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 70 | |
Dan Shi | 6a619b8 | 2020-04-13 09:29:16 -0700 | [diff] [blame] | 71 | # Include host shared libraries |
| 72 | host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES)) |
| 73 | |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 74 | $(if $(strip $(host_shared_libs)),\ |
| 75 | $(foreach p,$(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES),\ |
| 76 | $(eval _src := $(call word-colon,1,$(p)))\ |
| 77 | $(eval _dst := $(call word-colon,2,$(p)))\ |
| 78 | $(if $(strip $(ALL_TARGETS.$(_src).META_LIC)),\ |
Yihan Dong | 9b75c9e | 2022-09-07 11:15:01 +0800 | [diff] [blame^] | 79 | $(call declare-copy-target-license-metadata,$(_dst),$(_src)),\ |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 80 | $(warning $(_src) has no license metadata for $(_dst))\ |
| 81 | )\ |
| 82 | )\ |
| 83 | ) |
| 84 | |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 85 | compatibility_zip_deps := \ |
| 86 | $(test_artifacts) \ |
| 87 | $(test_tools) \ |
| 88 | $(test_suite_prebuilt_tools) \ |
| 89 | $(test_suite_dynamic_config) \ |
| 90 | $(test_suite_jdk) \ |
| 91 | $(MERGE_ZIPS) \ |
| 92 | $(SOONG_ZIP) \ |
| 93 | $(host_shared_libs) \ |
Yihan Dong | e45ff68 | 2022-03-25 13:57:05 +0800 | [diff] [blame] | 94 | $(test_suite_extra_deps) \ |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 95 | |
jschung | 904e173 | 2021-04-21 16:09:11 +0900 | [diff] [blame] | 96 | compatibility_zip_resources := $(out_dir)/tools $(out_dir)/testcases $(out_dir)/lib $(out_dir)/lib64 |
wangzhou | 23acb0b | 2020-07-21 17:18:01 -0700 | [diff] [blame] | 97 | |
| 98 | # Test Suite NOTICE files |
| 99 | test_suite_notice_txt := $(out_dir)/NOTICE.txt |
| 100 | test_suite_notice_html := $(out_dir)/NOTICE.html |
| 101 | |
Dan Shi | 413a530 | 2020-10-22 15:36:21 -0700 | [diff] [blame] | 102 | compatibility_zip_deps += $(test_suite_notice_txt) |
| 103 | compatibility_zip_resources += $(test_suite_notice_txt) |
wangzhou | e7f1725 | 2020-07-15 07:49:26 -0700 | [diff] [blame] | 104 | |
Dan Shi | fd48024 | 2021-10-04 11:04:14 -0700 | [diff] [blame] | 105 | compatibility_tests_list_zip := $(out_dir)-tests_list.zip |
| 106 | |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 107 | compatibility_zip := $(out_dir).zip |
Dan Shi | fd48024 | 2021-10-04 11:04:14 -0700 | [diff] [blame] | 108 | $(compatibility_zip) : .KATI_IMPLICIT_OUTPUTS := $(compatibility_tests_list_zip) |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 109 | $(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir) |
Todd Lee | bae7ee5 | 2017-06-01 08:00:32 -0700 | [diff] [blame] | 110 | $(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools) |
Aaron Holden | aee6f60 | 2015-12-15 15:04:01 -0800 | [diff] [blame] | 111 | $(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name) |
| 112 | $(compatibility_zip): PRIVATE_DYNAMIC_CONFIG := $(test_suite_dynamic_config) |
wangzhou | e7f1725 | 2020-07-15 07:49:26 -0700 | [diff] [blame] | 113 | $(compatibility_zip): PRIVATE_RESOURCES := $(compatibility_zip_resources) |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 114 | $(compatibility_zip): PRIVATE_JDK := $(test_suite_jdk) |
Dan Shi | fd48024 | 2021-10-04 11:04:14 -0700 | [diff] [blame] | 115 | $(compatibility_zip): PRIVATE_tests_list := $(out_dir)-tests_list |
| 116 | $(compatibility_zip): PRIVATE_tests_list_zip := $(compatibility_tests_list_zip) |
wangzhou | e7f1725 | 2020-07-15 07:49:26 -0700 | [diff] [blame] | 117 | $(compatibility_zip): $(compatibility_zip_deps) | $(ADB) $(ACP) |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 118 | # Make dir structure |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 119 | mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases |
| 120 | rm -f $@ $@.tmp $@.jdk |
| 121 | echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt |
Stuart Scott | 1926e9b | 2015-06-03 17:42:39 -0700 | [diff] [blame] | 122 | # Copy tools |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 123 | cp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools |
Dan Willemsen | 288bedf | 2019-05-28 15:36:47 -0700 | [diff] [blame] | 124 | $(if $(PRIVATE_DYNAMIC_CONFIG),$(hide) cp $(PRIVATE_DYNAMIC_CONFIG) $(PRIVATE_OUT_DIR)/testcases/$(PRIVATE_SUITE_NAME).dynamic) |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 125 | find $(PRIVATE_RESOURCES) | sort >$@.list |
| 126 | $(SOONG_ZIP) -d -o $@.tmp -C $(dir $@) -l $@.list |
| 127 | $(MERGE_ZIPS) $@ $@.tmp $(PRIVATE_JDK) |
| 128 | rm -f $@.tmp |
Dan Shi | fd48024 | 2021-10-04 11:04:14 -0700 | [diff] [blame] | 129 | # Build a list of tests |
| 130 | rm -f $(PRIVATE_tests_list) |
| 131 | $(hide) grep -e .*\\.config$$ $@.list | sed s%$(PRIVATE_OUT_DIR)/testcases/%%g > $(PRIVATE_tests_list) |
| 132 | $(SOONG_ZIP) -d -o $(PRIVATE_tests_list_zip) -j -f $(PRIVATE_tests_list) |
| 133 | rm -f $(PRIVATE_tests_list) |
Aaron Holden | aee6f60 | 2015-12-15 15:04:01 -0800 | [diff] [blame] | 134 | |
Bob Badour | 3a0f0c1 | 2022-04-05 10:43:45 -0700 | [diff] [blame] | 135 | $(call declare-0p-target,$(compatibility_tests_list_zip),) |
| 136 | |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 137 | $(call declare-1p-container,$(compatibility_zip),) |
Yihan Dong | 9b75c9e | 2022-09-07 11:15:01 +0800 | [diff] [blame^] | 138 | $(call declare-container-license-deps,$(compatibility_zip),$(compatibility_zip_deps) $(test_copied_tools), $(out_dir)/:/) |
Bob Badour | 42f00c7 | 2022-03-19 23:20:59 -0700 | [diff] [blame] | 139 | |
| 140 | $(eval $(call html-notice-rule,$(test_suite_notice_html),"Test suites","Notices for files contained in the test suites filesystem image:",$(compatibility_zip),$(compatibility_zip))) |
| 141 | $(eval $(call text-notice-rule,$(test_suite_notice_txt),"Test suites","Notices for files contained in the test suites filesystem image:",$(compatibility_zip),$(compatibility_zip))) |
| 142 | |
| 143 | $(call declare-0p-target,$(test_suite_notice_html)) |
| 144 | $(call declare-0p-target,$(test_suite_notice_txt)) |
| 145 | |
Bob Badour | 540a3f8 | 2022-04-20 13:01:16 -0700 | [diff] [blame] | 146 | $(call declare-1p-copy-files,$(test_suite_dynamic_config),) |
| 147 | $(call declare-1p-copy-files,$(test_suite_prebuilt_tools),) |
| 148 | |
Aaron Holden | aee6f60 | 2015-12-15 15:04:01 -0800 | [diff] [blame] | 149 | # Reset all input variables |
| 150 | test_suite_name := |
| 151 | test_suite_tradefed := |
| 152 | test_suite_dynamic_config := |
| 153 | test_suite_readme := |
Todd Lee | bae7ee5 | 2017-06-01 08:00:32 -0700 | [diff] [blame] | 154 | test_suite_prebuilt_tools := |
Siyuan Zhou | 1888315 | 2017-11-20 17:26:40 -0800 | [diff] [blame] | 155 | test_suite_tools := |
Colin Cross | fa4f720 | 2019-09-10 13:27:32 -0700 | [diff] [blame] | 156 | test_suite_jdk := |
| 157 | test_suite_jdk_dir := |
Dan Shi | 6a619b8 | 2020-04-13 09:29:16 -0700 | [diff] [blame] | 158 | host_shared_libs := |
Yihan Dong | e45ff68 | 2022-03-25 13:57:05 +0800 | [diff] [blame] | 159 | test_suite_extra_deps := |