-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for deadlocking rayon
- Loading branch information
1 parent
73b4fe5
commit 5d4e953
Showing
3 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use std::{fs::File, path::Path}; | ||
use jpeg_decoder::Decoder; | ||
|
||
#[test] | ||
fn decoding_in_limited_threadpool_does_not_deadlock() { | ||
let path = Path::new("tests").join("reftest").join("images").join("mozilla").join("jpg-progressive.jpg"); | ||
|
||
let pool = rayon::ThreadPoolBuilder::new() | ||
.num_threads(1) | ||
.build() | ||
.unwrap(); | ||
pool.install(|| { | ||
let mut decoder = Decoder::new(File::open(&path).unwrap()); | ||
let _ = decoder.decode().unwrap(); | ||
}); | ||
} |