1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use TokenStream;
use proc_macro_error;
/// Attribute to be placed on the test suite's module.
///
/// ## Arguments
/// - `default-timeout`: The default timeout in seconds for all tests in the suite. This can be overridden on a per-test basis. If not specified here or on a per-test basis, the default timeout is 60 seconds.
/// - `executor`: The custom executor to use for running async tests. This is only required if the features `embassy` and `external-executor` are enabled.
///
/// ## Examples
///
/// Define a test suite with a single test:
///
/// ```rust,no_run
/// #[embedded_test::tests]
/// mod tests {
/// #[init]
/// fn init() {
/// // Initialize the hardware
/// }
///
/// #[test]
/// fn test() {
/// // Test the hardware
/// }
/// }
/// ```
///
/// Define a test suite and customize everything:
///
/// ```rust,no_run
/// #[embedded_test::tests(default_timeout = 10, executor = embassy::executor::Executor::new())]
/// mod tests {
/// #[init]
/// fn init() {
/// // Initialize the hardware
/// }
///
/// #[test]
/// fn test() {
/// log::info("Start....")
/// // Test the hardware
/// }
///
/// #[test]
/// #[timeout(5)]
/// fn test2() {
/// // Test the hardware
/// }
/// }
/// ```
/// Attribute to be placed on a global setup function for the test suite
///
/// Use this function to set up a global logger
///
/// ## Examples
///
/// ```rust,no_run
/// #[cfg(test)]
/// #[embedded_test::setup]
/// fn setup() {
/// rtt_target::rtt_init_log!();
/// }
/// ```
///