Snap for 4722539 from 4ea0a82057635b2669995c147b6c3f03dede3dea to pi-release
Change-Id: I4080622dac50242dd26fb2588117412559c3348d
diff --git a/.gitignore b/.gitignore
index fe40911..298e2f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
# Distribution / packaging
.Python
env/
-/build/
develop-eggs/
dist/
downloads/
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..60cfc7e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+# Android Vendor Test Suite (VTS) Lab
+
+VTS Lab is an open source test serving infrastructure that can be used
+to streamline VTS and CTS-on-GSI (General System Image) tests.
diff --git a/build/Android.mk b/build/Android.mk
new file mode 100644
index 0000000..5790247
--- /dev/null
+++ b/build/Android.mk
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2018 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+VTSLAB_OUT_ROOT := $(HOST_OUT)/vtslab
+VTSLAB_TESTCASES_OUT := $(VTSLAB_OUT_ROOT)/android-vtslab/testcases
+VTSLAB_TOOLS_OUT := $(VTSLAB_OUT_ROOT)/android-vtslab/tools
+
+# Packaging rule for android-vtslab.zip
+test_suite_name := vtslab
+test_suite_readme := test/framework/README.md
+
+include $(LOCAL_PATH)/package.mk
+include test/vts/tools/build/utils/vts_package_utils.mk
+
+vts_lab_required_packages: run adb fastboot
+ echo "radio $(ALL_MODULES.WifiUtil.BUILT_INSTALLED)"
+
+.PHONY: vtslab
+vtslab: $(compatibility_zip) $(vts_lab_required_packages)
+$(call dist-for-goals, vtslab, $(compatibility_zip))
+
+
+host_hc_files := \
+ $(call find-files-in-subdirs,test/framework/harnesses/host_controller,"*.py" -and -type f,.)
+
+host_hc_copy_pairs := \
+ $(foreach f,$(host_hc_files),\
+ test/framework/harnesses/host_controller/$(f):$(VTSLAB_TESTCASES_OUT)/host_controller/$(f))
+
+host_hc_extra_copy_pairs := \
+ test/framework/tools/host_controller/run:$(VTSLAB_TOOLS_OUT)/run \
+
+host_acloud_files := \
+ $(call find-files-in-subdirs,tools/acloud,"*.py" -and -type f,.) \
+ $(call find-files-in-subdirs,tools/acloud,"*.config" -and -type f,.)
+
+host_acloud_copy_pairs := \
+ $(foreach f,$(host_acloud_files),\
+ tools/acloud/$(f):$(VTSLAB_TESTCASES_OUT)/acloud/$(f))
+
+host_vti_proto_files := \
+ $(call find-files-in-subdirs,test/vti/test_serving/proto,"*.py" -and -type f,.)
+
+host_vti_proto_copy_pairs := \
+ $(foreach f,$(host_vti_proto_files),\
+ test/vti/test_serving/proto/$(f):$(VTSLAB_TESTCASES_OUT)/vti/test_serving/proto/$(f))
+
+$(VTSLAB_TESTCASES_OUT)/vti/test_serving/__init__.py:
+ @mkdir -p $(VTSLAB_TESTCASES_OUT)/vti/test_serving
+ @touch $(VTSLAB_TESTCASES_OUT)/vti/test_serving/__init__.py
+
+$(VTSLAB_TESTCASES_OUT)/vti/__init__.py:
+ @mkdir -p $(VTSLAB_TESTCASES_OUT)/vti
+ @touch $(VTSLAB_TESTCASES_OUT)/vti/__init__.py
+
+host_vti_extra_copy_pairs := \
+ $(VTSLAB_TESTCASES_OUT)/vti/__init__.py \
+ $(VTSLAB_TESTCASES_OUT)/vti/test_serving/__init__.py \
+
+vts_host_python_files := \
+ $(call find-files-in-subdirs,test/vts,"*.py" -and -type f,.)
+
+vts_host_python_copy_pairs := \
+ $(foreach f,$(vts_host_python_files),\
+ test/vts/$(f):$(VTSLAB_TESTCASES_OUT)/vts/$(f))
+
+vtslab_apk_modules := \
+ WifiUtil \
+ CtsVerifier \
+
+vtslab_copy_pairs := \
+ $(call copy-many-files,$(vtslab_apk_modules)) \
+ $(call copy-many-files,$(host_hc_copy_pairs)) \
+ $(call copy-many-files,$(host_hc_extra_copy_pairs)) \
+ $(call copy-many-files,$(host_acloud_copy_pairs)) \
+ $(call copy-many-files,$(host_vti_proto_copy_pairs)) \
+ $(call copy-many-files,$(vts_host_python_copy_pairs)) \
+ $(host_vti_extra_copy_pairs) \
+
+$(compatibility_zip): $(vtslab_copy_pairs)
+
diff --git a/build/package.mk b/build/package.mk
new file mode 100644
index 0000000..d04b159
--- /dev/null
+++ b/build/package.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2018 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.
+
+# Package up a compatibility test suite in a zip file.
+#
+# Input variables:
+# test_suite_name: the name of this test suite eg. cts
+# test_suite_readme: the path to a README file for this test suite
+# test_suite_prebuilt_tools: the set of prebuilt tools to be included directly
+# in the 'tools' subdirectory of the test suite.
+# test_suite_tools: the set of tools for this test suite
+#
+# Output variables:
+# compatibility_zip: the path to the output zip file.
+
+out_dir := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)
+test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
+test_tools := $(test_suite_readme)
+test_tools += $(test_suite_tools)
+
+compatibility_zip := $(out_dir).zip
+$(compatibility_zip): PRIVATE_NAME := android-$(test_suite_name)
+$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
+$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
+$(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name)
+$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(SOONG_ZIP) | $(ADB) $(ACP)
+# Make dir structure
+ $(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
+# Copy tools
+ $(hide) $(ACP) -fp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
+ $(hide) find $(dir $@)/$(PRIVATE_NAME) | sort >$@.list
+ $(hide) $(SOONG_ZIP) -d -o $@ -C $(dir $@) -l $@.list
+
+# Reset all input variables
+test_suite_name :=
+test_suite_dynamic_config :=
+test_suite_readme :=
+test_suite_prebuilt_tools :=
+test_suite_tools :=
diff --git a/tools/host_controller/Android.mk b/tools/host_controller/Android.mk
new file mode 100644
index 0000000..f4ee939
--- /dev/null
+++ b/tools/host_controller/Android.mk
@@ -0,0 +1,21 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_PREBUILT_EXECUTABLES := run
+include $(BUILD_HOST_PREBUILT)
diff --git a/tools/host_controller/run b/tools/host_controller/run
new file mode 100755
index 0000000..6072e8c
--- /dev/null
+++ b/tools/host_controller/run
@@ -0,0 +1,48 @@
+#!/bin/bash
+# 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.
+
+# launcher script for vts-hc (host controller)
+# can be used from an Android build environment, or a standalone vts zip
+
+# get OS
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+ OS="linux-x86"
+elif [ "$HOST" == "Darwin" ]; then
+ OS="darwin-x86"
+else
+ echo "Unrecognized OS"
+ exit
+fi
+
+# check if in Android build env
+if [ ! -z "${ANDROID_BUILD_TOP}" ]; then
+ if [ ! -z "${ANDROID_HOST_OUT}" ]; then
+ VTS_ROOT=${ANDROID_HOST_OUT}/vtslab
+ else
+ VTS_ROOT=${ANDROID_BUILD_TOP}/${OUT_DIR:-out}/host/${OS}/vtslab
+ fi
+ if [ ! -d ${VTS_ROOT} ]; then
+ echo "Could not find $VTS_ROOT in Android build environment. Try 'make vts'"
+ exit
+ fi;
+fi;
+
+if [ -z ${VTS_ROOT} ]; then
+ # assume we're in an extracted vts install
+ VTS_ROOT="$(dirname $(readlink -e $0))/../.."
+fi;
+
+cd ${VTS_ROOT}/android-vtslab/testcases/; python -m host_controller.main "$@"