639c6ccf7a
A test can be disabled in two ways: 1. Add the test name to ALL_DISABLED_PRESUBMIT_TESTS variable. Integration tests (tests inside TradeFed) can only be disabled in this way. 2. In module config, set LOCAL_PRESUBMIT_DISABLED to true. This works for tests with build target. This change allows tests to be skipped in presubmit check to be saved in a list that's included in test-mappings.zip build artifact. Bug: 74971025 Test: m dist -j test-mapping Change-Id: I6e3016b017ce1ade024dc4ded72a10c778b88e7f
38 lines
1.8 KiB
Makefile
38 lines
1.8 KiB
Makefile
# Copyright (C) 2017 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Create an artifact to include TEST_MAPPING files in source tree. Also include
|
|
# a file (out/disabled-presubmit-tests) containing the tests that should be
|
|
# skipped in presubmit check.
|
|
|
|
.PHONY: test_mapping
|
|
|
|
intermediates := $(call intermediates-dir-for,PACKAGING,test_mapping)
|
|
test_mappings_zip := $(intermediates)/test_mappings.zip
|
|
test_mapping_list := $(OUT_DIR)/.module_paths/TEST_MAPPING.list
|
|
test_mappings := $(file <$(test_mapping_list))
|
|
$(test_mappings_zip) : PRIVATE_test_mappings := $(subst $(newline),\n,$(test_mappings))
|
|
$(test_mappings_zip) : PRIVATE_all_disabled_presubmit_tests := $(ALL_DISABLED_PRESUBMIT_TESTS)
|
|
|
|
$(test_mappings_zip) : $(test_mappings) $(SOONG_ZIP)
|
|
@echo "Building artifact to include TEST_MAPPING files and tests to skip in presubmit check."
|
|
rm -rf $@ $(dir $@)/disabled-presubmit-tests
|
|
echo $(sort $(PRIVATE_all_disabled_presubmit_tests)) | tr " " "\n" > $(dir $@)/disabled-presubmit-tests
|
|
echo -e "$(PRIVATE_test_mappings)" > $@.list
|
|
$(SOONG_ZIP) -o $@ -C . -l $@.list -C $(dir $@) -f $(dir $@)/disabled-presubmit-tests
|
|
rm -f $@.list $(dir $@)/disabled-presubmit-tests
|
|
|
|
test_mapping : $(test_mappings_zip)
|
|
|
|
$(call dist-for-goals, dist_files test_mapping,$(test_mappings_zip))
|