github.com/nya3jp/tast@v0.0.0-20230601000426-85c8e4d83a9b/src/go.chromium.org/tast/core/internal/protocol/testing.proto (about) 1 // Copyright 2021 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 syntax = "proto3"; 6 7 package tast.core; 8 9 import "google/protobuf/duration.proto"; 10 import "google/protobuf/timestamp.proto"; 11 12 import "go.chromium.org/tast/core/framework/protocol/dutfeatures.proto"; 13 import "features.proto"; 14 15 option go_package = "go.chromium.org/tast/core/internal/protocol"; 16 17 service TestService { 18 // ListEntities requests all entities available on the server. 19 rpc ListEntities(ListEntitiesRequest) returns (ListEntitiesResponse) {} 20 21 // GlobalRuntimeVars requests all global runtime variables declared on the 22 // server. 23 rpc GlobalRuntimeVars(GlobalRuntimeVarsRequest) 24 returns (GlobalRuntimeVarsResponse) {} 25 26 // RunTests requests to run tests. 27 // A client must send an initial request message containing RunTestsInit to 28 // a server. Then a server starts running tests and report progress in 29 // streamed response messages. 30 rpc RunTests(stream RunTestsRequest) returns (stream RunTestsResponse) {} 31 32 // GetDUTInfo requests to collect DUT system information. 33 rpc GetDUTInfo(GetDUTInfoRequest) returns (GetDUTInfoResponse) {} 34 35 // GetSysInfoState requests to collect the initial sysinfo state of the DUT. 36 rpc GetSysInfoState(GetSysInfoStateRequest) 37 returns (GetSysInfoStateResponse) {} 38 39 // CollectSysInfo requests to collect the sysinfo, considering diff from the 40 // given initial sysinfo state. 41 rpc CollectSysInfo(CollectSysInfoRequest) returns (CollectSysInfoResponse) {} 42 43 // DownloadPrivateBundles requests to download private bundles and install 44 // them to the DUT. 45 rpc DownloadPrivateBundles(DownloadPrivateBundlesRequest) 46 returns (DownloadPrivateBundlesResponse) {} 47 48 // StreamFile requests to stream a specify file. 49 rpc StreamFile(StreamFileRequest) returns (stream StreamFileResponse) {} 50 } 51 52 message ListEntitiesRequest { 53 Features features = 1; 54 // Recursive specifies whether to list entities on target bundles recursively. 55 bool recursive = 2; 56 } 57 58 message ListEntitiesResponse { 59 // Entities is a list of entities available on the server. The order of 60 // entities is unspecified. 61 repeated ResolvedEntity entities = 1; 62 } 63 64 message GlobalRuntimeVarsRequest {} 65 66 message GlobalRuntimeVar { string name = 1; } 67 68 message GlobalRuntimeVarsResponse { repeated GlobalRuntimeVar vars = 1; } 69 70 message RunTestsRequest { 71 oneof type { 72 RunTestsInit run_tests_init = 1; 73 StackOperationResponse stack_operation_response = 3; 74 } 75 reserved 2; 76 } 77 78 message RunTestsResponse { 79 oneof type { 80 RunLogEvent run_log = 1; 81 EntityStartEvent entity_start = 2; 82 EntityLogEvent entity_log = 3; 83 EntityErrorEvent entity_error = 4; 84 EntityEndEvent entity_end = 5; 85 EntityCopyEndEvent entity_copy_end = 8; 86 StackOperationRequest stack_operation = 6; 87 HeartbeatEvent heartbeat = 7; 88 } 89 } 90 91 message GetDUTInfoRequest { 92 // ExtraUseFlags lists USE flags that should be treated as being set in 93 // addition to the ones read from USEFlagsFile when computing the feature sets 94 // for GetDUTInfoResponse. 95 repeated string extra_use_flags = 1; 96 // Features specifies whether to get software/hardware features of the DUT. 97 bool features = 2; 98 } 99 100 message GetDUTInfoResponse { DUTInfo dut_info = 1; } 101 102 message GetSysInfoStateRequest {} 103 104 message GetSysInfoStateResponse { 105 // State contains the collected sysinfo state. 106 SysInfoState state = 1; 107 } 108 109 message CollectSysInfoRequest { 110 // InitialState describes the pre-testing state of the DUT. It should be 111 // generated by the GetSysInfoState method executed before tests are run. 112 SysInfoState initial_state = 1; 113 } 114 115 message CollectSysInfoResponse { 116 // LogDir is the directory which log files were copied to. The caller should 117 // delete it. 118 string log_dir = 1; 119 120 // CrashDir is the directory which minidump crash files were copied to. The 121 // caller should delete it. 122 string crash_dir = 2; 123 } 124 125 message DownloadPrivateBundlesRequest { 126 // ServiceConfig contains information needed to connect to the service 127 // provided by infrastructure system. 128 ServiceConfig service_config = 1; 129 130 // BuildArtifactsUrl is the URL of Google Cloud Storage directory, ending with 131 // a slash, containing build artifacts for the current ChromeOS image. 132 // If it is empty, DefaultBuildArtifactsURL in runner.Config is used. 133 string build_artifact_url = 2; 134 } 135 136 message DownloadPrivateBundlesResponse {} 137 138 message StreamFileRequest { 139 // Name is the name of the file which the content will be streamed. 140 string name = 1; 141 // Offset is where in the file that streaming should start. 142 // If the offset is negative, streaming will start at the end of file. 143 int64 offset = 2; 144 } 145 146 message StreamFileResponse { 147 // Content is the latest content from the log file. 148 bytes data = 1; 149 // Offset is where the current file point to after reading the current data. 150 int64 offset = 2; 151 } 152 153 // EntityType represents a type of an entity. 154 enum EntityType { 155 TEST = 0; 156 FIXTURE = 1; 157 } 158 159 // Entity describes an entity. 160 message Entity { 161 EntityType type = 1; 162 string name = 2; 163 string package = 3; 164 repeated string attributes = 4; 165 string description = 5; 166 string fixture = 6; 167 EntityDependencies dependencies = 7; 168 EntityContacts contacts = 8; 169 EntityLegacyData legacy_data = 9; 170 repeated StringPair search_flags = 10; 171 repeated string test_bed_deps = 11; 172 repeated string requirements = 12; 173 string bug_component = 13; 174 string lacros_status = 14; 175 } 176 177 // EntityContacts contains contact information of an entity. 178 message EntityContacts { repeated string emails = 1; } 179 180 // EntityDependencies describes dependencies of an entity that need to be 181 // evaluated before running it. 182 message EntityDependencies { 183 repeated string data_files = 1; 184 repeated string services = 2; 185 } 186 187 // EntityLegacyData contains extra information of an entity. 188 // Fields in this message are considered legacy because test bundles need to 189 // send these fields to Tast CLI just because they are made available in 190 // results.json for compatibility reasons. 191 message EntityLegacyData { 192 google.protobuf.Duration timeout = 1; 193 repeated string variables = 2; 194 repeated string variable_deps = 3; 195 repeated string software_deps = 4; 196 string bundle = 5; 197 } 198 199 message RunTestsInit { 200 RunConfig run_config = 1; 201 // Recursive specifies whether to run tests on target bundles recursively. 202 bool recursive = 2; 203 204 // DebugPort is the port which the debugger for the test bundle will listen 205 // on. Note that this field is only used for test runners, and not bundles. 206 uint32 debug_port = 10; 207 } 208 209 // RunConfig contains parameters needed to run tests in a test bundle. 210 message RunConfig { 211 // Tests is a list of test names to be run. Wildcards are not allowed. 212 repeated string tests = 1; 213 214 RunDirectories dirs = 2; 215 Features features = 3; 216 ServiceConfig service_config = 4; 217 DataFileConfig data_file_config = 5; 218 reserved 6; 219 StartFixtureState start_fixture_state = 7; 220 221 // HeartbeatInterval is the interval in seconds at which heartbeat messages 222 // are sent back periodically from runners (before running bundles) and 223 // bundles. If this value is not positive, heartbeat messages are not sent. 224 // TODO(crbug.com/1128259): Remove this field once we fully migrate to gRPC. 225 google.protobuf.Duration heartbeat_interval = 8; 226 227 // WaitUntilReady indicates that the test bundle's "ready" function (see 228 // ReadyFunc) should be executed before any tests are executed. 229 // TODO(crbug.com/1128259): Remove this field once we fully migrate to gRPC. 230 bool wait_until_ready = 9; 231 232 // DebugPort is the port that the bundle will attach the debugger to. 233 uint32 debug_port = 10; 234 235 // SystemServiceTimeout is timeout for waiting for system services to be ready 236 // in seconds. (Default: 120 seconds) 237 google.protobuf.Duration system_services_timeout = 11; 238 239 // Target specifies how the primary target bundle should run. 240 // This can be nil if no target bundle exists. 241 RunTargetConfig target = 12; 242 243 // MsgTimeout is the duration that the client waits for. 244 // If no activity is seen even after that the connection is closed. 245 // (Default: 60 seconds) 246 google.protobuf.Duration msg_timeout = 13; 247 248 // MaxSysMsgLogSize is a maximum size of /var/log/messages that Tast will 249 // copy. 250 int64 max_sys_msg_log_size = 14; 251 252 // WaitUntilReadyTimeout set a timeout for the entire ready.Wait function. 253 google.protobuf.Duration wait_until_ready_timeout = 15; 254 } 255 256 // RunTargetConfig contains parameters for the primary target bundle to run. 257 message RunTargetConfig { 258 // Devservers correspnods to config.Devservers. 259 repeated string devservers = 1; 260 // Dirs contains directories local tests use. 261 RunDirectories dirs = 2; 262 // DebugPort is the port that the bundle will attach the debugger to. 263 uint32 debug_port = 3; 264 // MaxTestFailures specifies maximum test failures allowed. 265 int32 max_test_failures = 4; 266 // Retries is the number of retries for failing tests. 267 int32 retries = 5; 268 // Proxy if true indicates that the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY 269 // environment variables (and their lowercase counterparts) should be 270 // forwarded to the DUT if set on the host. 271 bool proxy = 6; 272 // TODO(crbug.com/1128259): Remove this field once we fully migrate to gRPC. 273 bool wait_until_ready = 7; 274 // MsgTimeout is the duration that the client waits for. 275 // If no activity is seen even after that the connection is closed. 276 // (Default: 60 seconds) 277 google.protobuf.Duration msg_timeout = 8; 278 // SystemServiceTimeout is timeout for waiting for system services to be ready 279 // in seconds. (Default: 120 seconds) 280 google.protobuf.Duration system_services_timeout = 9; 281 // WaitUntilReadyTimeout set a timeout for the entire ready.Wait function. 282 //(Default: 120 seconds) 283 google.protobuf.Duration wait_until_ready_timeout = 10; 284 // SwarmingTaskID specifies the swarming task ID of the scheduled 285 // job that run Tast tests. 286 string SwarmingTaskID = 11; 287 // BuildBucketID specifies the build bucket ID of the scheduled 288 // job that run Tast tests. 289 string BuildBucketID = 12; 290 } 291 292 // RunDirectories holds several directory paths important for running tests. 293 message RunDirectories { 294 // DataDir is the path to the directory containing test data files. 295 string data_dir = 1; 296 // OutDir is the path to the base directory under which tests should write 297 // output files. 298 string out_dir = 2; 299 // TempDir is the path to the directory under which temporary files for tests 300 // are written. 301 string temp_dir = 3; 302 } 303 304 // ServiceConfig contains configurations of external services available to 305 // Tast framework and Tast tests. 306 message ServiceConfig { 307 // Devservers is a list of devserver URLs (e.g. "https://1.2.3.4:5678"). 308 // Devservers are used to download data files from Google Cloud Storage with 309 // cache. It is ignored if DUT Server is available. 310 repeated string devservers = 1; 311 312 // TlwServer is an address of a TLW server (e.g. "1.2.3.4:5678"). 313 // When this is set, it takes precedence over Devservers. 314 // Note: Obsolete. 315 string tlw_server = 2; 316 317 // TlwSelfName is a "DUT name" that identifies the current machine. 318 // It is empty for remote tests. 319 // Note: Obsolete. 320 string tlw_self_name = 3; 321 322 // TlwPrimaryTargetName is a "DUT name" of the primary target. 323 // It is empty if a primary target doesn't exist. 324 // Note: Obsolete. 325 string tlw_primary_target_name = 4; 326 327 // DutServer is an address of a DUT server (e.g. "1.2.3.4:5678"). 328 // When this is set, it takes precedence over Devservers. 329 string dut_server = 5; 330 331 // Following fields are only needed for remote tests. 332 333 // UseEphemeralDevserer instructs whether to use ephemeral devserver. 334 bool use_ephemeral_devservers = 6; 335 // TastDir used to specify cache directory. 336 string tast_dir = 7; 337 // ExtraAllowedBuckets specifies ephemeral devserver's allowed buckets. 338 repeated string extra_allowed_buckets = 8; 339 340 // SwarmingTaskID specifies the swarming task ID of the scheduled 341 // job that run Tast tests. 342 string SwarmingTaskID = 9; 343 // BuildBucketID specifies the build bucket ID of the scheduled 344 // job that run Tast tests. 345 string BuildBucketID = 10; 346 } 347 348 // DownloadMode specifies a strategy to download external data files. 349 enum DownloadMode { 350 // BATCH specifies that test bundles should download external data files 351 // in batch before running tests. 352 BATCH = 0; 353 // LAZY specifies that test bundles should download external data files 354 // as needed between tests. 355 LAZY = 1; 356 } 357 358 // DataFileConfig contains configurations about data files. 359 message DataFileConfig { 360 DownloadMode download_mode = 1; 361 362 // BuildArtifactsUrl is the URL of Google Cloud Storage directory, ending with 363 // a slash, containing build artifacts for the current ChromeOS image. 364 string build_artifacts_url = 2; 365 } 366 367 // StartFixtureState contains information of a start fixture. 368 message StartFixtureState { 369 // Name is the name of a start fixture. 370 string name = 1; 371 // Errors contains errors reported on dependent fixture setup. If it is not 372 // empty, all fixtures and tests should fail immediately. 373 repeated Error errors = 2; 374 } 375 376 // Error describes details of an error reported by an entity. 377 message Error { 378 string reason = 1; 379 ErrorLocation location = 2; 380 } 381 382 // ErrorLocation represents a code location where an error was reported. 383 message ErrorLocation { 384 string file = 1; 385 int64 line = 2; 386 string stack = 3; 387 } 388 389 // ResolvedEntity is similar to Entity, but contains additional fields computed 390 // from an original Entity and run time information. 391 message ResolvedEntity { 392 Entity entity = 1; 393 394 // Skips contains reasons why this test should be skipped. If it contains one 395 // or more reasons, the test should be skipped for unsatisfied dependencies. 396 // This field can be set only if the entity is a test. 397 Skip skip = 2; 398 399 // Hops contains the number of remote connection hops from the current machine 400 // and the machine serving the entity. 401 // On the host machine, hops=0 means remote entities (on the host machine) and 402 // hops=1 means local entities (on the DUT). 403 int32 hops = 3; 404 405 // StartFixtureName is the name of the fixture that needs to be set up 406 // externally in order to run this entity. 407 string start_fixture_name = 4; 408 } 409 410 // TimingLog is a protobuf presentation of a timing.Log. 411 message TimingLog { TimingStage root = 1; } 412 413 // TimingStage is a protobuf presentation of a completed timing.Stage. 414 message TimingStage { 415 string name = 1; 416 google.protobuf.Timestamp start_time = 2; 417 google.protobuf.Timestamp end_time = 3; 418 repeated TimingStage children = 4; 419 } 420 421 // RunLogEvent indicates that an informational log message not associated with 422 // an entity was produced. 423 message RunLogEvent { 424 google.protobuf.Timestamp time = 1; 425 string text = 2; 426 } 427 428 // EntityStartEvent marks the start of an entity run. EntityStartEvent is sent 429 // even if an entity is to be skipped. 430 message EntityStartEvent { 431 google.protobuf.Timestamp time = 1; 432 Entity entity = 2; 433 string out_dir = 3; 434 } 435 436 // EntityLogEvent indicates that an informational log message was produced by 437 // an entity. 438 message EntityLogEvent { 439 google.protobuf.Timestamp time = 1; 440 string entity_name = 2; 441 string text = 3; 442 } 443 444 // EntityErrorEvent indicates that an error was produced by an entity. 445 // A consumer should treat an entity as failed when it sees one or more errors 446 // reported for it. 447 message EntityErrorEvent { 448 google.protobuf.Timestamp time = 1; 449 string entity_name = 2; 450 Error error = 3; 451 } 452 453 // EntityEndEvent marks the end of an entity run. 454 message EntityEndEvent { 455 google.protobuf.Timestamp time = 1; 456 string entity_name = 2; 457 Skip skip = 3; 458 TimingLog timing_log = 4; 459 } 460 461 // EntityCopyEndEvent marks the end of an file copies after entity ends. 462 message EntityCopyEndEvent { string entity_name = 1; } 463 464 // Skip describes the reasons why an entity is skipped. 465 message Skip { repeated string reasons = 1; } 466 467 // DUTInfo holds DUT system information. 468 message DUTInfo { 469 reserved 1; 470 471 // Features contains features available on the DUT. 472 DUTFeatures features = 4; 473 474 // OsVersion contains the DUT's OS Version. 475 string os_version = 2; 476 477 // DefaultBuildArtifactsUrl specifies the default URL of the build artifacts. 478 string default_build_artifacts_url = 3; 479 } 480 481 // SysInfoState contains the state of the DUT's system information. 482 message SysInfoState { 483 // LogInodeSizes maps from each log file's inode to its size in bytes. 484 map<uint64, int64> log_inode_sizes = 1; 485 486 // UnifiedLogCursor contains an opaque cursor pointing at the current tip of 487 // unified system logs. 488 string unified_log_cursor = 2; 489 490 // CrashFilePaths contains absolute paths to crash files. 491 repeated string crash_file_paths = 3; 492 } 493 494 message StackOperationRequest { 495 oneof type { 496 StackReset reset = 1; 497 StackPreTest pre_test = 2; 498 StackPostTest post_test = 3; 499 StackGetStatus status = 4; 500 StackSetDirty set_dirty = 5; 501 StackGetErrors errors = 6; 502 StackValue value = 7; 503 } 504 } 505 506 message StackReset {} 507 508 message StackPreTest { 509 Entity entity = 1; 510 bool has_error = 2; 511 } 512 513 message StackPostTest { 514 Entity entity = 1; 515 bool has_error = 2; 516 } 517 518 message StackGetStatus {} 519 520 message StackSetDirty { bool dirty = 1; } 521 522 message StackGetErrors {} 523 524 message StackValue {} 525 526 message StackOperationResponse { 527 // FatalError is an framework internal error happened during operation. 528 string fatal_error = 1; 529 // Status is a response for StackGetStatus request. 530 // It's also populated in Reset's response. 531 StackStatus status = 2; 532 // Errors is a response for StackGetErrors request. 533 repeated Error errors = 3; 534 // TestHasError is a response for StackPreTest and StackPostTest request. 535 bool test_has_error = 4; 536 // FixtValue is the serialized fixture value of the fixture in current stack. 537 bytes fixt_value = 5; 538 } 539 540 enum StackStatus { 541 GREEN = 0; 542 RED = 1; 543 YELLOW = 2; 544 } 545 546 message HeartbeatEvent { google.protobuf.Timestamp time = 1; } 547 548 // A string key-value pair. 549 message StringPair { 550 // Regex: ^[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*$ 551 // Max length: 64. 552 string key = 1; 553 554 // Max length: 256. 555 string value = 2; 556 }