From 746d37044fb5d88de8dffc733d1ecbc947217be3 Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Mon, 18 Jul 2022 07:31:56 +0200 Subject: [PATCH] Update README and docs Signed-off-by: Heinz N. Gies --- README.md | 16 ++++++++++++++++ serial_test_derive/src/lib.rs | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/README.md b/README.md index 49a803e..963d3d5 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,19 @@ extern crate serial_test; for earlier versions. You can then either add `#[serial]` or `#[serial(some_text)]` to tests as required. + +For each test, a timeout can be specified with the `timeout_ms` parameter to the [serial](macro@serial) attribute. Note that +the timeout is counted from the first invocation of the test, not from the time the previous test was completed. This can +lead to some unpredictable behavior based on the number of parallel tests run on the system. +```rust +#[test] +#[serial(timeout_ms = 1000)] +fn test_serial_one() { + // Do things +} +#[test] +#[serial(test_name, timeout_ms = 1000)] +fn test_serial_another() { + // Do things +} +``` \ No newline at end of file diff --git a/serial_test_derive/src/lib.rs b/serial_test_derive/src/lib.rs index ad1a212..23b0446 100644 --- a/serial_test_derive/src/lib.rs +++ b/serial_test_derive/src/lib.rs @@ -33,6 +33,7 @@ use std::ops::Deref; /// If you want different subsets of tests to be serialised with each /// other, but not depend on other subsets, you can add an argument to [serial](macro@serial), and all calls /// with identical arguments will be called in serial. e.g. +/// /// ```` /// #[test] /// #[serial(something)] @@ -61,6 +62,24 @@ use std::ops::Deref; /// `test_serial_one` and `test_serial_another` will be executed in serial, as will `test_serial_third` and `test_serial_fourth` /// but neither sequence will be blocked by the other /// +/// For each test, a timeout can be specified with the `timeout_ms` parameter to the [serial](macro@serial) attribute. Note that +/// the timeout is counted from the first invocation of the test, not from the time the previous test was completed. This can +/// lead to some unpredictable behavior based on the number of parallel tests run on the system. +/// +/// ```` +/// #[test] +/// #[serial(timeout_ms = 1000)] +/// fn test_serial_one() { +/// // Do things +/// } +/// +/// #[test] +/// #[serial(timeout_ms = 1000)] +/// fn test_serial_another() { +/// // Do things +/// } +/// ```` +/// /// Nested serialised tests (i.e. a [serial](macro@serial) tagged test calling another) are supported #[proc_macro_attribute] #[proc_macro_error]