run_test_suite_lib/params.rs
1// Copyright 2022 The Fuchsia 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
5use diagnostics_data::Severity;
6use fidl_fuchsia_diagnostics::LogInterestSelector;
7use fidl_fuchsia_test_manager as ftest_manager;
8use std::sync::Arc;
9use test_list::TestTag;
10
11/// Parameters that specify how a single test suite should be executed.
12#[derive(Clone, Debug, PartialEq, Default)]
13pub struct TestParams {
14 /// Test URL.
15 pub test_url: String,
16
17 /// Provided test realm.
18 pub realm: Arc<Option<crate::realm::Realm>>,
19
20 /// Test timeout. Must be more than zero.
21 pub timeout_seconds: Option<std::num::NonZeroU32>,
22
23 /// Filter tests based on glob pattern(s).
24 pub test_filters: Option<Vec<String>>,
25
26 /// Whether an empty test case set means success or failure.
27 pub no_cases_equals_success: Option<bool>,
28
29 /// Run disabled tests.
30 pub also_run_disabled_tests: bool,
31
32 /// Test concurrency count.
33 pub parallel: Option<u16>,
34
35 /// Arguments to pass to test using command line.
36 pub test_args: Vec<String>,
37
38 /// Maximum allowable log severity for the test.
39 pub max_severity_logs: Option<Severity>,
40
41 /// Minimum requested log severity to print for the test.
42 pub min_severity_logs: Vec<LogInterestSelector>,
43
44 /// List of tags to associate with this test's output.
45 pub tags: Vec<TestTag>,
46
47 /// Stop the test suite on the first test failure so a debugger can attach.
48 pub break_on_failure: bool,
49
50 /// Don't create exception channels, which may conflict with the exception channels created
51 /// by the test.
52 pub no_exception_channel: bool,
53}
54
55/// Parameters that specify how the overall test run should be executed.
56#[derive(Debug, PartialEq)]
57pub struct RunParams {
58 /// The behavior of the test run if a suite times out.
59 pub timeout_behavior: TimeoutBehavior,
60
61 /// Time in seconds to wait for events to drain after timeout.
62 pub timeout_grace_seconds: u32,
63
64 /// If set, stop executing tests after this number of normal test failures occur.
65 pub stop_after_failures: Option<std::num::NonZeroU32>,
66
67 /// Whether or not to merge debug data from previous runs with new debug data collected
68 /// for this test run.
69 pub accumulate_debug_data: bool,
70
71 /// If set, set the protocol used to retrieve logs. If not set, an appropriate default
72 /// will be chosen by the implementation.
73 pub log_protocol: Option<ftest_manager::LogsIteratorType>,
74
75 /// If set, specifies the minimum log severity to report. As it is an
76 /// option for output, it will likely soon be moved to a reporter.
77 pub min_severity_logs: Vec<LogInterestSelector>,
78
79 /// If true, shows the full moniker in logs.
80 pub show_full_moniker: bool,
81}
82
83/// Sets the behavior of the overall run if a suite terminates with a timeout.
84#[derive(Debug, PartialEq)]
85pub enum TimeoutBehavior {
86 /// Immediately terminate any suites that haven't started.
87 TerminateRemaining,
88 /// Continue executing any suites that haven't finished.
89 Continue,
90}