1# Copyright 2021 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import enum 6import os 7 8 9class TestOption(enum.Enum): 10 # Do not build tests for all, or just some platforms. 11 DO_NOT_BUILD = "do_not_build" 12 DO_NOT_BUILD_AARCH64 = "do_not_build_aarch64" 13 DO_NOT_BUILD_ARMHF = "do_not_build_armhf" 14 DO_NOT_BUILD_X86_64 = "do_not_build_x86_64" 15 DO_NOT_BUILD_WIN64 = "do_not_build_win64" 16 17 # Build tests, but do not run for all, or just some platforms. 18 DO_NOT_RUN = "do_not_run" 19 DO_NOT_RUN_ARMHF = "do_not_run_armhf" 20 DO_NOT_RUN_AARCH64 = "do_not_run_aarch64" 21 DO_NOT_RUN_X86_64 = "do_not_run_x86_64" 22 23 # Do not run on foreign architecture kernel (e.g. running armhf on aarch64 24 # or running aarch64 on the host with user-space emulation) 25 # This option is expected on tests that use kernel APIs not supported in 26 # user space emulation or in armhf compatibility mode (most notably 27 # /dev/kvm usage) 28 DO_NOT_RUN_ON_FOREIGN_KERNEL = "do_not_run_on_foreign_kernel" 29 30 # Run tests single-threaded 31 SINGLE_THREADED = "single_threaded" 32 33 # This test needs longer than usual to run. 34 LARGE = "large" 35 36# Configuration to restrict how and where tests of a certain crate can 37# be build and run. 38# 39# Please add a bug number when restricting a tests. 40 41# This is just too big to keep in main list for now 42WIN64_DISABLED_CRATES = [ 43 "aarch64", 44 "acpi_tables", 45 "arch", 46 "assertions", 47 "audio_streams", 48 "bit_field_derive", 49 "bit_field", 50 "cros_async", 51 "cros_asyncv2", 52 "cros-fuzz", 53 "crosvm_control", 54 "crosvm_plugin", 55 "crosvm-fuzz", 56 "crosvm", 57 "data_model", 58 "devices", 59 "disk", 60 "ffi", 61 "fuse", 62 "fuzz", 63 "gpu_display", 64 "hypervisor", 65 "integration_tests", 66 "io_uring", 67 "kernel_cmdline", 68 "kernel_loader", 69 "kvm_sys", 70 "kvm", 71 "libcras_stub", 72 "libvda", 73 "linux_input_sys", 74 "minijail-sys", 75 "minijail", 76 "net_sys", 77 "net_util", 78 "p9", 79 "power_monitor", 80 "protos", 81 "qcow_utils", 82 "resources", 83 "rutabaga_gfx", 84 "rutabaga_gralloc", 85 "sync", 86 "sys_util", 87 "system_api_stub", 88 "tpm2-sys", 89 "tpm2", 90 "usb_sys", 91 "usb_util", 92 "vfio_sys", 93 "vhost", 94 "virtio_sys", 95 "vm_control", 96 "vm_memory", 97 "vmm_vhost", 98 "wire_format_derive", 99 "x86_64", 100 ] 101 102CRATE_OPTIONS: dict[str, list[TestOption]] = { 103 "base": [TestOption.SINGLE_THREADED, TestOption.LARGE], 104 "cros_async": [TestOption.LARGE], 105 "crosvm": [TestOption.SINGLE_THREADED], 106 "crosvm_plugin": [ 107 TestOption.DO_NOT_BUILD_AARCH64, 108 TestOption.DO_NOT_BUILD_ARMHF, 109 ], 110 "crosvm-fuzz": [TestOption.DO_NOT_BUILD], # b/194499769 111 "devices": [ 112 TestOption.SINGLE_THREADED, 113 TestOption.LARGE, 114 TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL, 115 ], 116 "disk": [TestOption.DO_NOT_RUN_AARCH64, TestOption.DO_NOT_RUN_ARMHF], # b/202294155 117 "fuzz": [TestOption.DO_NOT_BUILD], 118 "hypervisor": [ 119 TestOption.DO_NOT_RUN_AARCH64, 120 TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL, 121 ], # b/181672912 122 "integration_tests": [ # b/180196508 123 TestOption.SINGLE_THREADED, 124 TestOption.LARGE, 125 TestOption.DO_NOT_RUN_AARCH64, 126 TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL, 127 ], 128 "io_uring": [TestOption.DO_NOT_RUN], # b/202294403 129 "kvm_sys": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL], 130 "kvm": [ 131 TestOption.DO_NOT_RUN_AARCH64, 132 TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL, 133 ], # b/181674144 134 "libcrosvm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864 135 "libvda": [TestOption.DO_NOT_BUILD], # b/202293971 136 "rutabaga_gfx": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864 137 "sys_util": [TestOption.SINGLE_THREADED], 138 "sys_util_core": [TestOption.SINGLE_THREADED], 139 "vhost": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL], 140 "vm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864 141} 142 143for name in WIN64_DISABLED_CRATES: 144 CRATE_OPTIONS[name] = CRATE_OPTIONS.get(name, []) + [TestOption.DO_NOT_BUILD_WIN64] 145 146BUILD_FEATURES: dict[str, str] = { 147 "x86_64": "linux-x86_64", 148 "aarch64": "linux-aarch64", 149 "armhf": "linux-armhf", 150 "win64": "win64", 151} 152