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.
56pub struct RunParams {
57    /// The behavior of the test run if a suite times out.
58    pub timeout_behavior: TimeoutBehavior,
59
60    /// Time in seconds to wait for events to drain after timeout.
61    pub timeout_grace_seconds: u32,
62
63    /// If set, stop executing tests after this number of normal test failures occur.
64    pub stop_after_failures: Option<std::num::NonZeroU32>,
65
66    /// Whether or not to merge debug data from previous runs with new debug data collected
67    /// for this test run.
68    pub accumulate_debug_data: bool,
69
70    /// If set, set the protocol used to retrieve logs. If not set, an appropriate default
71    /// will be chosen by the implementation.
72    pub log_protocol: Option<ftest_manager::LogsIteratorType>,
73
74    /// If set, specifies the minimum log severity to report. As it is an
75    /// option for output, it will likely soon be moved to a reporter.
76    pub min_severity_logs: Vec<LogInterestSelector>,
77
78    /// If true, shows the full moniker in logs.
79    pub show_full_moniker: bool,
80}
81
82/// Sets the behavior of the overall run if a suite terminates with a timeout.
83#[derive(PartialEq)]
84pub enum TimeoutBehavior {
85    /// Immediately terminate any suites that haven't started.
86    TerminateRemaining,
87    /// Continue executing any suites that haven't finished.
88    Continue,
89}