XTS测试环境要求(Host端)

XTS测试环境要求(Host端)

最近遇到几个测试环境问题,由此整理以下xts测试对于环境的要求。(host端ubuntu测试机环境)

数据来自google官网文档,截至2021年1月:CTS、GTS、VTS、CTS-on-GSI、TVTS、STS。

CTS:Setting up CTS

Caution: CTS supports 64-bit Linux and macOS host machines. CTS doesn't work on Windows OS.

ADB and AAPT

Note: For CTS 8.0, use version 1.0.39 of adb.

Before running the CTS, ensure that you have installed the recent versions of both Android Debug Bridge (adb) and Android Asset Packaging Tool (AAPT) and added the location of those tools to the system path of your machine.

To install ADB, download the Android SDK Tools package for your operating system, open it, and follow the instructions in the included README file. For troubleshooting information, see Installing the Stand-alone SDK Tools.

Ensure that adb and aapt are in your system path. The following command assumes that you've opened the package archive in your home directory:

export PATH=$PATH:$HOME/android-sdk-linux/build-tools/version 

Note: Ensure that your starting path and directory name are correct.

Java Development Kit for Ubuntu

Install the proper version of Java Development Kit (JDK).

  • For Android 11, install OpenJDK11.
  • For Android 9 and Android 10, install OpenJDK9.
  • For Android 7.0, 7.1, 8.0 and 8.1, install OpenJDK8.

For details, see the JDK requirements.

CTS files

Download and open the CTS packages from Compatibility Test Suite Downloads matching your devices' Android version and all the application binary interfaces (ABIs) that your devices support.

Download and open the latest version of the CTS media files.

Device detection

Follow the step to set up your system to detect your device.

Memory limit

You might want to increase the maximum memory available during test run in the cts-tradfed script. Refer to example CL for more information.

GTS:Running GTS

Set up the Android Debug Bridge (adb) on the host machine (if needed)

  1. Make sure you have a recent copy of adb installed on your machine.

  2. To install ADB, download the Android SDK Tools package for your operating system, open it, and follow the instructions in the included README file.

  3. Ensure 'adb' is in your system path. For example:

  4. export PATH=$PATH:$HOME/android-sdk-linux/platform-tools/<version>

Set up GTS Authentication Procedure for GTS Business Logic (BL) a.k.a. GTS on Cloud

Google is adding the ability to customize GTS and other test suites to specific Partners. Customizations may relate to specific Partners devices and therefore test customizations are restricted to authorized parties. This also gives the ability to fix the logic (in case any issue) on the server without changing and releasing the GTS binary.

For more information on Business Logic, see the Business Logic page.

Prerequisites

Prior to executing the test, the following steps should be completed.

  • Get the authentication key file from your Google Account manager or your 3rd party lab.
  • Save key file to a location accessible to host server.
  • Set environment variable "APE_API_KEY" to the absolute path of the key file.
export APE_API_KEY='path_to_key.json'

DefaultIntentTest test will fail if authentication is not correctly setup as follows:

run gts -m GtsPlacementTestCases -tcom.google.android.placement.gts.DefaultIntentTest#testDefaultIntentHandlers

If your testing environment is set up correctly, but you still see failures, verify that the product exists in the Android Partner Approvals Portal (APA). If a search for the product name does not appear in APA, you need to submit a GTS/CTS report to APA. This report does not need to be complete. It is recommended to follow the instructions for registering new products for provisional GMS testing so that your device is not treated as an uncertified device. To create a report, run:

run cts -m CtsCurrentApiSignatureTestCases -tandroid.signature.cts.api.SignatureTest#testSignature

Do not skip device info collection.

VTS:Systems Testing With VTS/VTS-Treble Compliance

Establishing a test environment

To set up a testing environment:

  1. Install Python development kit:
sudo apt-get install python-dev 

Install Protocol Buffer tools (for Python):

sudo apt-get install python-protobuf sudo apt-get install protobuf-compiler 

Install Python virtual environment-related tools:

sudo apt-get install python-virtualenv
sudo apt-get install python-pip

Setting up the host

To setup a host machine to run VTS:

  1. Follow the instructions for Setting Up the CTS.
  2. Setup the test environment as detailed in Systems Testing with VTS on source.android.com.
  3. Download and unzip the VTS package.

For running VTS for Android 10 or higher, make sure you have the following modules installed in your workstation:

  • Java 9
  • Python 2.7 (Python Setuptools should be ≤ 44.0.0.)
  • Python PIP 20.2.2 or higher
  • virtualenv 20.0.27 or higher

CTS-on-GSI:Running CTS-on-GSI

Setting up the host

To setup a host machine to run CTS:

  1. Follow the instructions for Setting Up the CTS.
  2. Ensure that you have the CTS test plan:
    • For Android 8.0, download and unzip the CTS package.
    • For Android 8.1 and higher, the CTS test plan for the GSI is included in the VTS package.

TVTS:Using TVTS

  1. Ensure that Android SDK is installed and that the $PATH variable includes the path to the directory for the adb and aapt executables.

For more details on adb, see the Android developer documentation on SDK tools.

Running tests

Important: As of 1.0 R2, running TVTS requires Java version 9/OpenJDK 1.9.

STS:Security Test Suite

Setting up STS

STS is similar to Android's Compatibility Test Suite. To get started with STS, follow the CTS setup instructions.

上一篇:如何使用工厂+策略模式 优化多线程中的if else


下一篇:《刻意练习之C#》-0006- 类型系统