From 7c549f3e6113234478028056e11aa5b73c1871bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Mon, 19 Feb 2024 09:58:40 +0100 Subject: [PATCH] Document why tests are ignored --- pkcs11/src/api/token.rs | 12 ++++++++---- pkcs11/src/backend/session.rs | 4 ++++ pkcs11/src/config/config_file.rs | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkcs11/src/api/token.rs b/pkcs11/src/api/token.rs index 4413da01..87c6183a 100644 --- a/pkcs11/src/api/token.rs +++ b/pkcs11/src/api/token.rs @@ -428,7 +428,8 @@ mod tests { use super::*; - // ignored because it needs to be run alone on one thread + // Ignored by default because it would race with the other #[ignore] tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_wait_for_slot_event_no_event() { @@ -441,7 +442,8 @@ mod tests { assert_eq!(result, cryptoki_sys::CKR_NO_EVENT); } - // ignored because it needs to be run alone on one thread + // Ignored by default because it would race with the other #[ignore] tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_wait_for_slot_event_one_event() { @@ -460,7 +462,8 @@ mod tests { assert_eq!(slot, 0); } - // we ignore this test because it requires cargo test -- --test-threads=1 + // Ignored by default because it would race with the other #[ignore] tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_wait_for_slot_event_blocking_one_event() { @@ -483,7 +486,8 @@ mod tests { assert_eq!(slot, 0); } - // we ignore this test because it requires cargo test -- --test-threads=1 + // Ignored by default because it would race with the other #[ignore] tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_wait_for_slot_event_blocking_finalize() { diff --git a/pkcs11/src/backend/session.rs b/pkcs11/src/backend/session.rs index fcf8d7d1..a4b7d04b 100644 --- a/pkcs11/src/backend/session.rs +++ b/pkcs11/src/backend/session.rs @@ -700,6 +700,8 @@ mod test { use super::*; + // Ignored by default due to network access + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn parrallel_fetch_all_keys() { @@ -741,6 +743,8 @@ mod test { }) } + // Ignored by default due to network access + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn parrallel_fetch_all_keys_fail() { diff --git a/pkcs11/src/config/config_file.rs b/pkcs11/src/config/config_file.rs index 0454446b..500531f0 100644 --- a/pkcs11/src/config/config_file.rs +++ b/pkcs11/src/config/config_file.rs @@ -231,6 +231,8 @@ mod tests { use super::*; + // Ignored by default due ENV variable being changed for the duration of the tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_read_home_config() { @@ -276,6 +278,8 @@ slots: fs::remove_dir_all(home).unwrap(); } + // Ignored by default due ENV variable being changed for the duration of the tests + // Run with cargo test -- --test-threads=1 --ignored #[test] #[ignore] fn test_read_config_no_file() {