github.com/nya3jp/tast@v0.0.0-20230601000426-85c8e4d83a9b/docs/test_dependencies.md (about) 1 # Tast Test Dependencies (go/tast-deps) 2 3 A test may specify software or hardware features that must be supported on the DUT 4 in order for the test to run successfully. If one or more features aren't 5 supported by the DUT, the test will usually be skipped. See the `tast` command's 6 `-checktestdeps` flag to control this behavior. 7 8 Tests specify dependencies through the `SoftwareDeps` and `HardwareDeps` fields in [testing.Test]. 9 10 [testing.Test]: https://godoc.org/chromium.googlesource.com/chromiumos/platform/tast.git/src/go.chromium.org/tast/core/testing#Test 11 12 ## Software dependencies 13 14 ### Existing features 15 16 The following software features are defined: 17 18 * `amd64` - The [amd64] processor architecture. 19 * `amd_cpu` - Boards that contain an AMD application processor. 20 * `android_vm` - The ability to [run Android apps] in VM instead of container. 21 Any version of Android R+ can be used. Prefer this over `android_vm_r` if possible. 22 * `android_vm_r` - `android_vm` feature that runs in R VM. 23 * `android_p` - The ability to [run Android apps] that require Android P. 24 * `arc` - The ability to [run Android apps] in any way, in VM or container, 25 with any Android version. This is intended to be used to run non-ARC tests 26 only when ARC is supported on the board. 27 * `arc32` - Runs 32-bit Android primary ABI. 28 * `arc64` - Runs 64-bit Android primary ABI, may or may not have 32-bit support. 29 * `arc_android_data_cros_access` - The ability to access Android's /data directory from ChromeOS. 30 For ARCVM virtio-blk /data devices, this only ensures that we can mount the virtio-blk disk 31 image of Android's /data directory on the host, and does not grant an automatic access to 32 Android's /data directory from the host side. 33 * `arc_camera3` - Using [Camera HAL3] interface in Chrome and Android. 34 * `arc_launched_32bit` - This platform originally launched with 32-bit Android. 35 * `arc_launched_64bit` - This platform originally launched with 64-bit Android. 36 * `arm` - The [arm] 32 and 64 bit processor architecture. 37 * `aslr` - Address space layout randomization, which mitigates buffer-overflow 38 attacks, is functional (this is not true for builds with [AddressSanitizer] 39 instrumentation built in). 40 * `auto_update_stable` - No suffix like -kernelnext and -arc-r in the board name. 41 Auto update to a stable version is possible. 42 * `autotest-capability:foo` - An [Autotest capability] named `foo`. See below. 43 * `biometrics_daemon` - The ability to process fingerprint authentication. 44 This implies the presence of the `biod` package. 45 * `bluetooth_floss` - Excludes boards that do not support the floss bluetooth adapter. 46 * `boot_perf_info` - Reven (ChromeOS Flex) doesn't support boot performance metrics. 47 * `borealis_host` - Boards that can host the Borealis system. 48 * `bpf` - Whether the platform (kernel) has the bpf syscall enabled. 49 * `breakpad` - Whether the platform supports the breakpad crash handler 50 for Chrome. 51 * `camera_720p` - The ability to capture video with frame size 1280x720. 52 * `camera_app` - The ability to run the builtin camera app. 53 * `camera_feature_auto_framing` - Whether Auto Framing is enabled on this platform. 54 * `camera_feature_effects` - Whether camera effects are enabled on this platform. 55 * `camera_feature_hdrnet` - Whether HDRnet is enabled on this platform. 56 * `camera_feature_portrait_mode` - Whether Portrait Mode is enabled on this platform. 57 * `cert_provision` - The ability to use an additional cert_provision library 58 that supports an interface for provisioning machine-wide certificates and 59 using them for signing data on top of cryptohome dbus interface. 60 * `chrome` - Support for performing user login via Chrome (i.e. using 61 `session_manager` and `cryptohome`). This also implies that the 62 [chromeos-chrome] Portage package is installed (which also installs Chrome 63 binary tests), and that the `ui` Upstart job is present. 64 * `chromeless` - Explicit *lack* of support for login via Chrome. 65 * `chromeos_firmware` - Boards that use ChromeOS firmware. 66 * `chromeos_kernelci` - Whether the image built for https://chromeos.kernelci.org/ or not. 67 * `chrome_internal` - Functionality that is only available in internal builds 68 of Chrome (e.g. official branding). Any test that specifies this dependency 69 should also explicitly specify a `chrome` dependency. 70 * `coresched` - Whether device supports core scheduling feature for secure HT. 71 * `cpuidle_teo` - Availability of the TEO cpuidle governor. 72 * `cpu_heterogeneous` - Whether device has heterogeneous CPU topology. 73 * `cpu_vuln_sysfs` - Whether the platform has /sys/devices/system/cpu/vulnerabilities sysfs files 74 * `cras` - Whether the platform supports the ChromeOS Audio Server. 75 * `crashpad` - Whether the platform supports the crashpad crash handler for 76 Chrome. 77 * `cros_internal` - Functionality that is only available in internal builds of 78 ChromeOS (i.e. ones built using `chromeos-overlay`). 79 * `crossystem` - ChromeOS firmware/system interface utility. 80 * `crostini_stable` - Boards that can run Crostini tests reliably. 81 * `crostini_unstable` - Boards that cannot run Crostini tests reliably. 82 * `crosvm_gpu` - Boards that use hardware GPU acceleration in the guest VM environment. 83 * `crosvm_no_gpu` - Boards that use software GPU emulation in the guest VM environment. 84 * `crosvm_swap - Boards that have crosvm's vmm-swap feature enabled. 85 * `cups` - CUPS daemon. 86 * `device_crash` - Boards that can recover gracefully after a hard crash (e.g. 87 kernel crash) 88 * `diagnostics` - Boards that contain generic cross-platform 89 [Diagnostic utilities]. 90 * `dlc` - Support of [Downloadable Content] (DLC). 91 * `dmverity_stable` - Kernels with which dm-verity runs stably. See [b/172227689](https://b.corp.google.com/issues/172227689). 92 * `dmverity_unstable` - Kernels having known issue of dm-verity causing random crashes. See [b/172227689](https://b.corp.google.com/issues/172227689). 93 * `dptf` - Support of [Intel Dynamic Platform and Thermal Framework] (DPTF). 94 * `drivefs` - Google Drive support enabled. 95 * `drm_atomic` - The [DRM/KMS] kernel subsystem supports atomic commits. 96 * `drm_trace` - The [DRM/KMS] kernel subsystem supports tracing using tracefs. 97 * `ec_crash` - Boards that have EC firmware, implement the `crash` EC command, 98 and produce a panicinfo file after a crash. 99 * `ec_system_safe_mode` - Boards that have support for EC system safe mode, 100 which allows for collecting additional debug info after a crash. 101 * `endorsement` - Whether the system have a valid endorsement certificate. 102 * `faceauth` - Whether the system has faceauth functionality enabled, go/cros-faceauth. 103 * `factory_flow`- Device is subject to the [go/chromeos-factory-flow](http://go/chromeos-factory-flow) (e.g. most devices). 104 * `fake_hps` - Whether the HPS daemon (go/cros-hps) uses a fake software 105 device for testing purposes. 106 * `firewall` - Standard ChromeOS network firewall rules. 107 * `flashrom` - Userspace utility to update firmware. 108 * `flex_id` - Enable using [flex_id](http://go/chromeos-flex-id) for enrollment. 109 * `ghostscript` - Ghostscript and dependent packages are available for printing. 110 * `google_virtual_keyboard` - The proprietary Google onscreen virtual keyboard 111 (as opposed to the builtin open-source virtual keyboard). 112 * `gpu_sandboxing` - Chrome's GPU process is [sandboxed]. 113 * `gsc` - Whether the platform has an onboard Google security chip. 114 * `houdini` - Availability of 32-bit Houdini library for ARC. 115 * `houdini64` - Availability of 64-bit Houdini library for ARC. 116 * `hostap_hwsim` - Whether system has the hostap project's test dependencies 117 (scripts, daemons) installed and configured appropriately. 118 * `hps` - Whether the system has the hps daemon and tools, go/cros-hps. 119 * `igt` - Boards that can run igt-gpu-tools tests 120 * `iioservice` - Whether the device has CrOS IIO Service running. 121 * `inference_accuracy_eval` - Whether the device has inference accuracy evaluation tools installed. 122 * `ikev2` - The ability to run an IKEv2 VPN. 123 * `io_uring` - Whether the platform (kernel) has the io_uring syscalls enabled. 124 * `iwlwifi_rescan` - Ability to remove/rescan WiFi PCI device when the 125 hardware becomes non-responsive. 126 * `lacros` - Whether the system supports running [lacros]. 127 * `lacros_stable` - Whether the system supports running [lacros] and is stable enough for CQ. [TODO: Remove this.](crbug.com/1412276) 128 * `lacros_unstable` - Whether the system supports running [lacros] and is not stable enough for CQ. [TODO: Remove this.](crbug.com/1412276) 129 * `landlock_enabled` - Whether the system supports the Landlock Linux Security Module. 130 * `manatee` - The system is running a ManaTEE image. 131 * `mbo` - WiFi MBO support. 132 * `memfd_create` - memfd_create function implemented in the kernel. 133 * `memd` - [Memory stats collection daemon]. 134 * `microcode` - Platforms that have CPU microcode. 135 * `ml_service` - ML Service daemon. 136 * `ml_benchmark_drivers` - [ML benchmarking suite](http://go/roadrollerda) 137 * `mosys` - Ability to run mosys command. 138 * `nacl` - Availability of the Native Client sandboxing technology. 139 * `ndk_translation` - Availability of 32-bit NDK translation library for ARC. 140 * `ndk_translation64` - Availability of 64-bit NDK translation library for 141 ARC. 142 * `nnapi` - Has the nnapi (libneuralnetworks.so) installed. Run minimal VTS tests. 143 * `nnapi_vendor_driver` - Run the full VTS / CTS test suite. Ignores VM's. 144 * `no_android` - The inability to run Android apps. This is the opposite of 145 the `android` feature; DUTs will have exactly one of these two features. 146 * `no_arm` - The absence of [arm] 32 bit userspace. 147 * `no_asan` - Build was not built with Address Sanitizer. Similar to `aslr`. 148 * `no_ath10k_4_4` - Skip boards using the ath10k/ar10k driver on kernel 4.4, as they are missing certain features (b/138406224). 149 * `no_borealis_host` - Boards which is not designed to host borealis. 150 * `no_chrome_dcheck` - Chrome/Chromium was not built with dcheck enabld`. 151 * `no_eth_loss_on_reboot` - Board does not lose ethernet on reboot. Context: b/178529170 152 * `no_iioservice` - Build was not built with CrOS IIO Service. 153 * `no_manatee` - Build was not built with ManaTEE enabled. 154 * `no_msan` - Build was not built with Memory Sanitizer. 155 * `no_ondevice_handwriting` - Doesn't have on-device handwriting recognition support. Either ml_service is not enabled, or if ml_service doesn't support `ondevice_handwriting`. 156 * `no_arc_userdebug` - Skip boards that ship ARC userdebug build. 157 * `no_arc_x86` - Skip on x86 architecture. 158 * `no_qemu` - For tests not for ChromeOS QEMU images. 159 * `no_symlink_mount` - Symlink mounting is disabled via the 160 `CONFIG_SECURITY_CHROMIUMOS_NO_SYMLINK_MOUNT` kernel option. 161 * `no_tablet_form_factor` - The device's primary form factor is not tablet 162 * `no_tpm2_simulator` - Built was not built with the simulator of Trusted Platform Module supporting TPMv2. 163 * `no_tpm_dynamic` - Build was not built with dynamic TPM. 164 * `no_ubsan` - Build was not built with Undefined Behavior Sanitizer. 165 * `no_vulkan` - Build was not built with [Vulkan] enabled. 166 * `no_arcvm_virtio_blk_data` - Build was not built with ARCVM virtio-blk /data enabled. 167 * `no_gsc` - Build was not built with onboard Google security chip support. 168 * `nvme` - Ability to run NVMe software utilities. 169 * `oci` - The ability to use the `run_oci` program to execute code within 170 [OCI] containers. 171 * `ocr` - [Optical Character Recognition Service] daemon. 172 * `ondevice_document_scanner` - On-device document scanner support in `ml_service` which installed document scanner library in rootfs. 173 This implies `ml_service`. 174 * `ondevice_document_scanner_rootfs_or_dlc` - On-device document scanner support in `ml_service`. 175 This implies `ml_service`. 176 * `ondevice_grammar` - On-device grammar check support in `ml_service`. 177 * `ondevice_handwriting` - On-device handwriting recognition support in `ml_service`. 178 * `ondevice_speech` - On-device speech recognition support in `ml_service`. 179 * `ondevice_text_suggestions` - On-device txt suggestions support in `ml_service`. 180 * `pinweaver` - Pinweaver support, either by GSC or Intel CSME. 181 This implies `ml_service`. 182 * `play_store` - Boards where Google Play Store is supported. 183 * `plugin_vm` - The ability to run Plugin VMs. 184 * `proprietary_codecs` - Indicates if Chrome supports proprietary video 185 codecs (e.g. H.264). This is supported by Chrome official builds and Chromium 186 builds with the |propietary_codecs| build flag set. 187 * `protected_content` - Platform has HW backed OEMCrypto implementation for Widevine 188 L1 HW DRM. 189 * `qemu` - For tests exclusive to ChromeOS QEMU images. 190 * `racc` - Whether [Runtime AVL Compliance Check] is available. 191 * `reboot` - The ability to reboot reliably during a remote test. 192 * `rrm_support` - Driver support for 802.11k RRM. 193 * `screenshot` - The [screenshot command] can save screenshots. 194 * `selinux` - An SELinux-enabled board. All Android boards are 195 SELinux-enabled. 196 * `selinux_current` - All SELinux-enabled boards except experimental boards. 197 This implies `selinux`. 198 * `selinux_experimental` - An experimental SELinux board. An experimental 199 board has `SELINUX=permissive` in `/etc/selinux/config`, thus no policy 200 will be enforced. This implies `selinux`. 201 * `shill-wifi` - WiFi technology is enabled for Shill. 202 * `siernia` - Sirenia is present on a non-ManaTEE image. 203 * `smartdim` - Use smart dim to defer the imminent screen dimming. 204 * `smartctl` - Ability to run smartctl software utility. 205 * `stack_sampled_metrics` - Ability to run the stack profiler and gather 206 stack-sampled metrics. 207 * `storage_wearout_detect` - The ability to measure storage device health. 208 * `tablet_form_factor` - The device's primary form factor is tablet 209 * `tast_vm` - The test is running in a VM [managed by chromite](https://chromium.googlesource.com/chromiumos/chromite/+/HEAD/lib/cros_test.py#396). 210 * `tflite_opencl` - Skips boards which have issues with the OpenCL TFLite 211 delegate (b/233851820). 212 * `thread_safe_libva_backend` - Boards where the LIBVA backend is threadsafe. 213 * `tpm` - A [Trusted Platform Module] chip. 214 * `tpm_clear_allowed` - The device's TPM can be cleared. 215 * `tpm1` - Indicate a Trusted Platform Module supporting TPMv1.2 is available. Note that TPMv2 is not backward compatible. 216 * `tpm2` - Indicate a Trusted Platform Module supporting TPMv2 is available. 217 * `tpm2_simulator` - Indicate the simulator of Trusted Platform Module supporting TPMv2 is available. 218 * `tpm_dynamic` - Indicate the dynamic TPM is available. 219 * `transparent_hugepage` - [Transparent Hugepage] support in the Linux kernel. 220 * `unibuild` - The ChromeOS build is a unified build. 221 * `untrusted_vm` - The ability to run an untrusted VM. 222 * `usbguard` - The ability to allow or block USB devices based on policy. 223 * `usb_hid_wake` - The platform will register HID wake events to a usb device. 224 * `use_fscrypt_v1` - The board is set to use v1 fscrypt policy for user vault. 225 * `use_fscrypt_v2` - The board is set to use v2 fscrypt policy for user vault. 226 * `uvc_compliant` - The board has a UVC driver that is V4L2 compliant. 227 * `v4l2_codec` - Whether or not v4l2 video acceleration API is supported by this DUT. 228 * `vaapi` - Whether or not VA-API is supported by this DUT. 229 * `video_cards_ihd` - Boards that use the Intel Media Driver (also known as iHD) for VA-API. 230 * `video_decoder_direct` - The platform uses the VideoDecoder (VD) by default. 231 * `video_decoder_legacy` - The platform used the VideoDecodeAccelerator (VDA) by default. 232 * `video_decoder_legacy_supported` - Is the VDA is supported on this platform. 233 * `video_overlays` - The kernel [DRM/KMS] version atomic commits and the underlying hardware display controller support the NV12 DRM Plane format needed to promote videos to [hardware overlays]. 234 * `virtual_susupend_time_injection` - The platform supports KVM virtual suspend time injection. 235 * `virtual_usb_printer` - Whether or not the device can run tests that 236 use [virtual USB printing][virtual-usb-printer-readme]. Note that 237 while the necessary kernel modules are available on kernel v4.4, 238 this feature excludes that version for known flakiness. See 239 [this bug](https://b.corp.google.com/issues/172224081) for context. 240 * `vm_host` - The ability to [run virtual machines]. 241 * `vpd` - The DUT has a VPD chip. 242 * `vulkan` - Whether [Vulkan] is enabled. 243 * `watchdog` - watchdog daemon 244 * `wifi` - If this DUT has WiFi device. 245 * `wpa3_sae` - The ability to use WPA3-SAE authentication for WiFi. 246 * `wilco` - If this DUT is a [wilco] device. These features include 247 the DTC (Diagnostic and Telemetry Controller) VM, a special EC interface, 248 and a dock firmware updater. 249 * `wireguard` - The ability to run a WireGuard VPN. 250 * `no_kernel_upstream` - Skip boards with continuously-rebased kernel. 251 252 [amd64]: https://en.wikipedia.org/wiki/X86-64 253 [arm]: https://en.wikipedia.org/wiki/ARM_architecture 254 [run Android apps]: https://developer.android.com/topic/arc/ 255 [Camera HAL3]: https://source.android.com/devices/camera/camera3 256 [Camera HAL1]: https://source.android.com/devices/camera#architecture-legacy 257 [Linux Video Capture]: https://chromium.googlesource.com/chromium/src/+/HEAD/media/capture/video/linux/ 258 [AddressSanitizer]: https://github.com/google/sanitizers/wiki/AddressSanitizer 259 [Autotest capability]: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/main/chromeos-base/autotest-capability-default/ 260 [chromeos-chrome]: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/main/chromeos-base/chromeos-chrome/chromeos-chrome-9999.ebuild 261 [media::VideoDecoder]: https://cs.chromium.org/chromium/src/media/base/video_decoder.h 262 [Diagnostic utilities]: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/diagnostics/README.md 263 [Downloadable Content]: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/dlcservice 264 [DRM/KMS]: https://www.kernel.org/doc/Documentation/gpu/drm-kms.rst 265 [hardware overlays]: https://en.wikipedia.org/wiki/Hardware_overlay 266 [Intel Dynamic Platform and Thermal Framework]: https://01.org/intel%C2%AE-dynamic-platform-and-thermal-framework-dptf-chromium-os 267 [lacros]: https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/lacros.md 268 [sandboxed]: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux_sandboxing.md 269 [Memory stats collection daemon]: https://chromium.googlesource.com/chromiumos/platform2/+/main/metrics/memd/ 270 [OCI]: https://www.opencontainers.org/ 271 [Optical Character Recognition Service]: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/ocr/README.md 272 [Runtime AVL Compliance Check]: https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/main/runtime_probe/README.md 273 [screenshot command]: https://chromium.googlesource.com/chromiumos/platform2/+/main/screen-capture-utils/ 274 [Trusted Platform Module]: https://en.wikipedia.org/wiki/Trusted_Platform_Module 275 [Transparent Hugepage]: https://www.kernel.org/doc/Documentation/vm/transhuge.txt 276 [run virtual machines]: https://chromium.googlesource.com/chromiumos/docs/+/main/containers_and_vms.md 277 [Vulkan]: https://www.khronos.org/vulkan/ 278 [virtual-usb-printer-readme]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/virtual-usb-printer/README.md 279 [wilco]: https://sites.google.com/corp/google.com/wilco/home 280 281 ### New features 282 283 Features should be descriptive and precise. Consider a hypothetical test that 284 exercises authentication using a biometrics daemon that isn't present in system 285 images built to run on virtual machines. Instead of adding a `real_hardware` or 286 `non_vm` feature that is overly broad and will likely be interpreted as carrying 287 additional meaning beyond the original intent, add a `biometrics_daemon` feature 288 that precisely communicates the test's actual requirement. 289 290 Features are composed from USE flags and board names, which are statically 291 defined when the system image is built. [software_defs.go] lists boolean 292 expressions that are used to generate features; for example, an imaginary 293 feature named `hd_audio` with the expression 294 295 ```go 296 cras && (audio_chipset_a || audio_chipset_b) && !broken_headphone_jack 297 ``` 298 299 will be reported as available on systems where the `cras` USE flag is set, 300 either `audio_chipset_a` or `audio_chipset_b` is set, and 301 `broken_headphone_jack` is explicitly *not* set. 302 303 A feature can depend on board names, too. Another imaginary feature 304 named `vm_graphics` with the expression 305 306 ```go 307 "board:betty-pi-arc" 308 ``` 309 310 will be reported as available on `betty-pi-arc` board only. 311 312 Before a new `USE` flag can be used in an expression, it must be added to `IUSE` 313 in the [tast-use-flags] package. Local changes to the `tast-use-flags` ebuild 314 have to be pushed to the DUT manually to take effect: 315 316 ``` 317 cros_workon-$BOARD start chromeos-base/tast-use-flags 318 emerge-$BOARD chromeos-base/tast-use-flags 319 cros deploy --root=/usr/local $HOST chromeos-base/tast-use-flags 320 ``` 321 322 When submitting changes to add new `USE` flags to the [tast-use-flags] package, 323 please use [Cq-Depend] in your commit messages to ensure that changes land in 324 the correct order. 325 326 If you're having trouble finding a way to specify your test's dependencies, 327 please ask for help on the [tast-users mailing list]. 328 329 [software_defs.go]: https://chromium.googlesource.com/chromiumos/platform/tast/+/main/src/go.chromium.org/tast/core/internal/crosbundle/software_defs.go 330 [tast-use-flags]: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/main/chromeos-base/tast-use-flags/ 331 [Cq-Depend]: https://chromium.googlesource.com/chromiumos/docs/+/main/contributing.md#cq-depend 332 [tast-users mailing list]: https://groups.google.com/a/chromium.org/g/tast-users 333 334 #### Example changes 335 336 See the following changes for an example of adding a new `containers` software 337 feature based on the `containers` USE flag and making a test depend on it: 338 339 * `chromiumos-overlay` repository: <https://crrev.com/c/1382877> 340 * `tast` repository: <https://crrev.com/c/1382621> 341 * `tast-tests` repository: <https://crrev.com/c/1382878> 342 343 (Note that the `containers` feature has since been renamed to `oci`.) 344 345 ### autotest-capability 346 347 There are also `autotest-capability:`-prefixed features, which are added by the 348 [autocaps package] as specified by YAML files in 349 `/usr/local/etc/autotest-capability`. This exists in order to support porting 350 existing Autotest-based video tests to Tast. Do not depend on capabilities from 351 outside of video tests. 352 353 [autocaps package]: https://godoc.org/chromium.googlesource.com/chromiumos/platform/tast.git/src/go.chromium.org/tast/core/autocaps/ 354 355 356 ## Hardware dependencies 357 358 Tast provides a way to run/skip tests based on the device characteristics. 359 360 Note that "device characteristics" here only consists of information that can 361 be determined solely based on the DUT, without depending on the other 362 surrounding environment, such as some config files on DUT. 363 364 The examples of the device characteristics are as follows: 365 366 * Whether the device has a touch screen. 367 * Whether the device has fingerprint. 368 * Whether the device has an internal display. 369 370 For example, in order to run tests on DUT where touchscreen is available, 371 the dependency can be declared in the `HardwareDeps` field of `testing.Test`. 372 373 ```go 374 func init() { 375 testing.AddTest(&testing.Test{ 376 ... 377 HardwareDeps: hwdep.D(hwdep.Touchscreen()), 378 ... 379 }) 380 } 381 ``` 382 383 You can provide multiple `Condition`s to `hwdep.D`. In the case, 384 the test will run only on DUTs where all the conditions are satisfied. 385 386 You can find the full list of supported conditions in the [hwdep package]. 387 388 Note that there are special kinds of hardware dependencies, named `Model` and 389 `SkipOnModel`. 390 With these dependencies, tests will be controlled based on the device type names, 391 rather than the device characteristics. 392 In general, it is recommended *not* to use these conditions. If you feel you need 393 these conditions, it is recommended to reconsider whether there is an alternative 394 (and more appropriate) condition. 395 Examples of their expected use cases are: 396 397 * There are known issues in a driver of a specific device, which cannot be 398 fixed immediately. The test is stable on other models, and we would like 399 to promoted it to critical. 400 * There is a test running as informational. Flakiness failures are found 401 only on a few models, but the test is stable on other models. 402 With depending models, we can promote the test to critical on 403 most of models, except ones where the test results flakiness. 404 In this case, it is expected that a dedicated engineer is assigned to 405 investigate the cause and its fix. 406 407 [hwdep package]: https://chromium.googlesource.com/chromiumos/platform/tast/+/main/src/go.chromium.org/tast/core/testing/hwdep/ 408 409 ### Adding new hardware conditions 410 411 In order to guarantee forward compatibility in ChromeOS infra, 412 each `Condition` should be based on the 413 `chromiumos.config.api.HardwareFeatures` protobuf schema. 414 415 For example, the `hwdep.Touchscreen()` can check 416 whether `Screen.TouchSupport` is set to `HardwareFeatures_PRESENT`. 417 418 Note that currently a `chromiumos.config.api.HardwareFeatures` instance is 419 generated internally by Tast at runtime, so only limited fields are filled. 420 In the future, ChromeOS Infra test scheduler will be responsible for checking 421 hardware dependencies before running Tast tests. 422 423 Here is an example end-to-end workflow: 424 Let’s assume that a developer wants to add a new Tast test which requires a new 425 hardware feature to be used in the test hardware constraints (e.g. “wifi chip 426 vendor name is X”). 427 428 1. The developer makes a change for that hardware feature. 429 * The developer files a CL for a change to the schema 430 [(config/api/topology.proto)][1] to add a new field for the feature. 431 * A domain expert approves the change in the .proto file 432 [(config/api/topology.proto)][1]. [(Example CL)][2] 433 1. To test locally, run these commands to regenerate the go proto bindings. 434 ``` 435 ~/chromiumos/src/config/generate.sh 436 cros workon --host start cros-config-api 437 sudo emerge cros-config-api 438 ``` 439 1. The developer waits until the CL in #1 is landed, then implements 440 some functions in the Tast framework supporting the new feature(s) using the 441 new message type. 442 * The Tast team reviews and approves such a change to Tast. 443 [Here is an example CL][3] which puts some data into the protobuf in Tast. 444 1. The developer writes test(s) with hwdeps in its test metadata using the 445 above function in Tast. 446 447 [1]: https://source.chromium.org/chromium/infra/infra/+/HEAD:go/src/go.chromium.org/chromiumos/config/proto/chromiumos/config/api/topology.proto 448 [2]: https://chromium-review.googlesource.com/c/chromiumos/config/+/2249691/4/proto/chromiumos/config/api/topology.proto 449 [3]: https://chromium-review.googlesource.com/c/chromiumos/platform/tast/+/2335615