1# 2# Copyright (C) 2017 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_MODULE_CLASS := TEST_CONFIG 18 19# Output test config files to testcases directory. 20ifeq (,$(filter general-tests, $(LOCAL_COMPATIBILITY_SUITE))) 21 LOCAL_COMPATIBILITY_SUITE += general-tests 22endif 23 24LOCAL_MODULE_SUFFIX := .config 25 26my_test_config_file := $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE).xml) 27LOCAL_SRC_FILES := 28 29include $(BUILD_SYSTEM)/base_rules.mk 30 31# The test config is not in a standalone XML file. 32ifndef my_test_config_file 33 34ifndef LOCAL_TEST_CONFIG_OPTIONS 35 $(call pretty-error,LOCAL_TEST_CONFIG_OPTIONS must be set if the test XML file is not provided.) 36endif 37 38my_base_test_config_file := $(LOCAL_PATH)/AndroidTest.xml 39my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))AndroidTest.xml 40 41$(my_test_config_file) : PRIVATE_test_config_options := $(LOCAL_TEST_CONFIG_OPTIONS) 42$(my_test_config_file) : $(my_base_test_config_file) 43 @echo "Create $(notdir $@) with options: $(PRIVATE_test_config_options)." 44 $(eval _option_xml := \ 45 $(foreach option,$(PRIVATE_test_config_options), \ 46 $(eval p := $(subst :,$(space),$(option))) \ 47 <option name="$(word 1,$(p))" value="$(word 2,$(p))" \/>\n)) 48 $(hide) sed 's&</configuration>&$(_option_xml)</configuration>&' $< > $@ 49 50endif # my_test_config_file 51 52$(LOCAL_BUILT_MODULE) : $(my_test_config_file) 53 $(copy-file-to-target) 54 55my_base_test_config_file := 56my_test_config_file := 57