Skip to content

Commit 822c175

Browse files
committed
Allow infinite test runs
1 parent ce68a95 commit 822c175

File tree

1 file changed

+8
-4
lines changed
  • turbopack/crates/turbo-tasks-testing/src

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,36 @@ where
102102
let infinite_memory_runs = !infinite_initial_runs && env::var("INFINITE_MEMORY_RUNS").is_ok();
103103
let single_run = infinite_initial_runs || env::var("SINGLE_RUN").is_ok();
104104
let name = closure_to_name(&fut);
105+
let mut i = 1;
105106
loop {
106107
let tt = registration.create_turbo_tasks(&name, true);
107-
println!("Run #1 (without cache)");
108+
println!("Run #{i} (without cache)");
108109
let start = std::time::Instant::now();
109110
let first = fut(tt.clone()).await?;
110-
println!("Run #1 took {:?}", start.elapsed());
111+
println!("Run #{i} took {:?}", start.elapsed());
112+
i += 1;
111113
if !single_run {
112114
let max_run = if infinite_memory_runs { usize::MAX } else { 10 };
113-
for i in 2..max_run {
115+
for _ in 0..max_run {
114116
println!("Run #{i} (with memory cache, same TurboTasks instance)");
115117
let start = std::time::Instant::now();
116118
let second = fut(tt.clone()).await?;
117119
println!("Run #{i} took {:?}", start.elapsed());
120+
i += 1;
118121
assert_eq!(first, second);
119122
}
120123
}
121124
let start = std::time::Instant::now();
122125
tt.stop_and_wait().await;
123126
println!("Stopping TurboTasks took {:?}", start.elapsed());
124127
if !single_run {
125-
for i in 10..20 {
128+
for _ in 10..20 {
126129
let tt = registration.create_turbo_tasks(&name, false);
127130
println!("Run #{i} (with filesystem cache if available, new TurboTasks instance)");
128131
let start = std::time::Instant::now();
129132
let third = fut(tt.clone()).await?;
130133
println!("Run #{i} took {:?}", start.elapsed());
134+
i += 1;
131135
let start = std::time::Instant::now();
132136
tt.stop_and_wait().await;
133137
println!("Stopping TurboTasks took {:?}", start.elapsed());

0 commit comments

Comments
 (0)