Skip to content

Commit eeedf17

Browse files
committed
Do multiple unit test runs
1 parent 5bae225 commit eeedf17

File tree

1 file changed

+18
-14
lines changed
  • turbopack/crates/turbo-tasks-testing/src

1 file changed

+18
-14
lines changed

turbopack/crates/turbo-tasks-testing/src/run.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,26 @@ where
109109
let start = std::time::Instant::now();
110110
let first = fut(tt.clone()).await?;
111111
println!("Run #1 took {:?}", start.elapsed());
112-
println!("Run #2 (with memory cache, same TurboTasks instance)");
113-
let start = std::time::Instant::now();
114-
let second = fut(tt.clone()).await?;
115-
println!("Run #2 took {:?}", start.elapsed());
116-
assert_eq!(first, second);
117-
let start = std::time::Instant::now();
118-
tt.stop_and_wait().await;
119-
println!("Stopping TurboTasks took {:?}", start.elapsed());
120-
let tt = registration.create_turbo_tasks(&name, false);
121-
println!("Run #3 (with persistent cache if available, new TurboTasks instance)");
122-
let start = std::time::Instant::now();
123-
let third = fut(tt.clone()).await?;
124-
println!("Run #3 took {:?}", start.elapsed());
112+
for i in 2..10 {
113+
println!("Run #{i} (with memory cache, same TurboTasks instance)");
114+
let start = std::time::Instant::now();
115+
let second = fut(tt.clone()).await?;
116+
println!("Run #{i} took {:?}", start.elapsed());
117+
assert_eq!(first, second);
118+
}
125119
let start = std::time::Instant::now();
126120
tt.stop_and_wait().await;
127121
println!("Stopping TurboTasks took {:?}", start.elapsed());
128-
assert_eq!(first, third);
122+
for i in 10..20 {
123+
let tt = registration.create_turbo_tasks(&name, false);
124+
println!("Run #{i} (with persistent cache if available, new TurboTasks instance)");
125+
let start = std::time::Instant::now();
126+
let third = fut(tt.clone()).await?;
127+
println!("Run #{i} took {:?}", start.elapsed());
128+
let start = std::time::Instant::now();
129+
tt.stop_and_wait().await;
130+
println!("Stopping TurboTasks took {:?}", start.elapsed());
131+
assert_eq!(first, third);
132+
}
129133
Ok(())
130134
}

0 commit comments

Comments
 (0)