Skip to content

Commit 83ef81d

Browse files
authored
Faster miri runs (#1)
1 parent d2432cf commit 83ef81d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/aead_impl/tests.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,17 @@ fn parse_test_vectors() -> Vec<TestVector> {
136136
fn test_all_official_vectors() {
137137
let vectors = parse_test_vectors();
138138

139-
for vector in &vectors {
139+
// Under miri, only test every 20th vector to keep test time reasonable
140+
// Full coverage is still validated in regular test runs
141+
#[cfg(miri)]
142+
let test_vectors = vectors.iter().step_by(20);
143+
#[cfg(miri)]
144+
let test_vectors_len = test_vectors.clone().count();
145+
146+
#[cfg(not(miri))]
147+
let test_vectors = vectors.iter();
148+
149+
for vector in test_vectors {
140150
// Encrypt in-place
141151
let mut buffer = vector.plaintext.clone();
142152
let tag = encrypt_in_place(
@@ -189,6 +199,14 @@ fn test_all_official_vectors() {
189199
);
190200
}
191201

202+
#[cfg(miri)]
203+
println!(
204+
"Successfully tested {} of {} test vectors under miri",
205+
test_vectors_len,
206+
vectors.len()
207+
);
208+
209+
#[cfg(not(miri))]
192210
println!("Successfully tested {} test vectors", vectors.len());
193211
}
194212

0 commit comments

Comments
 (0)