File tree Expand file tree Collapse file tree 3 files changed +47
-4
lines changed Expand file tree Collapse file tree 3 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ png = "0.16"
19
19
walkdir = " 2.0"
20
20
criterion = " 0.3"
21
21
22
+ [features ]
23
+ default = [" rayon" ]
24
+ platform_independent = []
25
+ nightly_aarch64_neon = []
26
+
27
+ # # Internal development configuration: testing and benchmarking
28
+
22
29
[[bench ]]
23
30
name = " decoding_benchmark"
24
31
harness = false
@@ -31,8 +38,10 @@ harness = false
31
38
name = " rayon"
32
39
required-features = [" rayon" ]
33
40
34
- [features ]
35
- default = [" rayon" ]
36
- platform_independent = []
37
- nightly_aarch64_neon = []
41
+ [[test ]]
42
+ name = " rayon-0"
43
+ required-features = [" rayon" ]
38
44
45
+ [[test ]]
46
+ name = " rayon-1"
47
+ required-features = [" rayon" ]
Original file line number Diff line number Diff line change
1
+ //! Must be a separate test because it modifies the _global_ rayon pool.
2
+ use std:: { fs:: File , path:: Path } ;
3
+ use jpeg_decoder:: Decoder ;
4
+
5
+ #[ test]
6
+ fn decoding_in_global_pool ( ) {
7
+ let path = Path :: new ( "tests" ) . join ( "reftest" ) . join ( "images" ) . join ( "mozilla" ) . join ( "jpg-progressive.jpg" ) ;
8
+
9
+ rayon:: ThreadPoolBuilder :: new ( )
10
+ . num_threads ( 1 )
11
+ . build_global ( )
12
+ . unwrap ( ) ;
13
+
14
+ let mut decoder = Decoder :: new ( File :: open ( & path) . unwrap ( ) ) ;
15
+ let _ = decoder. decode ( ) . unwrap ( ) ;
16
+ }
Original file line number Diff line number Diff line change
1
+ //! Must be a separate test because it modifies the _global_ rayon pool.
2
+ use std:: { fs:: File , path:: Path } ;
3
+ use jpeg_decoder:: Decoder ;
4
+
5
+ #[ test]
6
+ fn decoding_in_fetched_global_pool ( ) {
7
+ let path = Path :: new ( "tests" ) . join ( "reftest" ) . join ( "images" ) . join ( "mozilla" ) . join ( "jpg-progressive.jpg" ) ;
8
+
9
+ rayon:: ThreadPoolBuilder :: new ( )
10
+ . num_threads ( 1 )
11
+ . build_global ( )
12
+ . unwrap ( ) ;
13
+
14
+ rayon:: scope ( |_| {
15
+ let mut decoder = Decoder :: new ( File :: open ( & path) . unwrap ( ) ) ;
16
+ let _ = decoder. decode ( ) . unwrap ( ) ;
17
+ } )
18
+ }
You can’t perform that action at this time.
0 commit comments