1# 2# Copyright (C) 2016 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_PATH := $(call my-dir) 18 19include $(call all-subdir-makefiles) 20 21ifeq ($(HOST_OS),linux) 22 23# ACTS framework 24ACTS_DISTRO := $(HOST_OUT)/acts-dist/acts.zip 25 26$(ACTS_DISTRO): $(sort $(shell find $(LOCAL_PATH)/acts)) 27 @echo "Packaging ACTS into $(ACTS_DISTRO)" 28 @mkdir -p $(HOST_OUT)/acts-dist/ 29 @rm -f $(HOST_OUT)/acts-dist/acts.zip 30 $(hide) zip $(HOST_OUT)/acts-dist/acts.zip $(shell find tools/test/connectivity/acts/* ! -wholename "*__pycache__*") 31acts: $(ACTS_DISTRO) 32.PHONY: acts 33 34$(call dist-for-goals,acts tests,$(ACTS_DISTRO)) 35 36 37# core ACTS test suite 38ACTS_TESTS_DISTRO_DIR := $(HOST_OUT)/acts_tests-dist 39ACTS_TESTS_DISTRO := $(ACTS_TESTS_DISTRO_DIR)/acts_tests.zip 40LOCAL_ACTS_TESTS_DIR := tools/test/connectivity/acts_tests 41LOCAL_ACTS_FRAMEWORK_DIR := tools/test/connectivity/acts/framework 42 43$(ACTS_TESTS_DISTRO): $(sort $(shell find $(LOCAL_PATH)/acts*)) 44 @echo "Packaging ACTS core test suite into $(ACTS_TESTS_DISTRO)" 45 @rm -rf $(ACTS_TESTS_DISTRO_DIR) 46 # Copy over the contents of acts_tests, resolving symlinks 47 @rsync -auv --copy-links $(LOCAL_ACTS_TESTS_DIR)/ $(ACTS_TESTS_DISTRO_DIR) 48 # Copy over the ACTS framework 49 @rsync -auv $(LOCAL_ACTS_FRAMEWORK_DIR)/ $(ACTS_TESTS_DISTRO_DIR)/acts_framework 50 # Make a zip archive 51 @cd $(ACTS_TESTS_DISTRO_DIR) && find . ! -wholename "*__pycache__*" -printf "%P\n" | xargs zip acts_tests.zip 52acts_tests: $(ACTS_TESTS_DISTRO) 53.PHONY: acts_tests 54 55$(call dist-for-goals,acts_tests tests,$(ACTS_TESTS_DISTRO)) 56 57 58# Wear specific Android Connectivity Test Suite 59WTS_ACTS_DISTRO_DIR := $(HOST_OUT)/wts-acts-dist 60WTS_ACTS_DISTRO := $(WTS_ACTS_DISTRO_DIR)/wts-acts 61WTS_ACTS_DISTRO_ARCHIVE := $(WTS_ACTS_DISTRO_DIR)/wts-acts.zip 62WTS_LOCAL_ACTS_DIR := tools/test/connectivity/acts/framework/acts/ 63 64$(WTS_ACTS_DISTRO): $(SOONG_ZIP) 65 @echo "Packaging WTS-ACTS into $(WTS_ACTS_DISTRO)" 66 # clean-up and mkdir for dist 67 @rm -Rf $(WTS_ACTS_DISTRO_DIR) 68 @mkdir -p $(WTS_ACTS_DISTRO_DIR) 69 # grab the files from local acts framework and zip them up 70 $(hide) find $(WTS_LOCAL_ACTS_DIR) | sort >$@.list 71 $(hide) $(SOONG_ZIP) -d -P acts -o $(WTS_ACTS_DISTRO_ARCHIVE) -C tools/test/connectivity/acts/framework/acts/ -l $@.list 72 # add in the local wts py files for use with the prebuilt 73 $(hide) zip -r $(WTS_ACTS_DISTRO_ARCHIVE) -j tools/test/connectivity/wts-acts/*.py 74 # create executable tool from the archive 75 $(hide) echo '#!/usr/bin/env python' | cat - $(WTS_ACTS_DISTRO_DIR)/wts-acts.zip > $(WTS_ACTS_DISTRO_DIR)/wts-acts 76 $(hide) chmod 755 $(WTS_ACTS_DISTRO) 77 78wts-acts: $(WTS_ACTS_DISTRO) 79.PHONY: wts-acts 80 81$(call dist-for-goals,wts-acts tests,$(WTS_ACTS_DISTRO)) 82 83 84 85endif 86