VTS Purpose: HAL and Kernel Interface Testing
While CTS ensures that the framework provides a consistent API to applications, the Vendor Test Suite (VTS) ensures that the vendor partition provides a consistent, standardized interface to the Android framework.
Introduced alongside Project Treble, VTS tests the Hardware Abstraction Layers (HALs) and the Linux kernel. A passing VTS score is mandatory for a device to be considered Treble-compliant, which allows the framework partition to be updated independently of the vendor partition.
VTS HAL Tests
Every standardized HAL defined in hardware/interfaces (using HIDL or AIDL) has an accompanying set of VTS tests. These tests instantiate the vendor's HAL implementation directly, bypassing the Android framework entirely.
For example, the VTS tests for the Camera HAL will initialize the camera driver, request frame captures, and verify that the data structures returned match the HIDL/AIDL specification.
# Run VTS tests for the Camera Provider HAL
atest VtsHalCameraProviderV2_4TargetTest
If a vendor heavily customizes a HAL, they must ensure their implementation still passes these strict interface contracts.
VTS Kernel Tests
VTS also validates the underlying Linux kernel. Android relies on specific kernel features (like ashmem, binder, eBPF, and specific scheduler behaviors).
VTS kernel tests compile down to native binaries and use the kselftest framework to verify:
- Kernel Configuration: Checking that required
CONFIG_*flags are enabled indefconfig. - ABI Compatibility: Ensuring that kernel data structures have not been altered in ways that break userspace ABI.
- LTS Compliance: Verifying that the vendor's kernel incorporates necessary Long Term Support (LTS) patches.
Running VTS on Device
Running VTS requires a device with an unlocked bootloader, as it often necessitates flashing a Generic System Image (GSI) to verify that the vendor implementation works with a pure, unmodified AOSP framework.
# Start the VTS tradefed console
./vts/tools/vts-tradefed
# Run a specific VTS module
vts-tf > run vts -m VtsKernelLtp
Debugging VTS failures often requires deep dives into native C/C++ code, using tools like gdb or lldb attached to the specific HAL process that is crashing during the test.