@@ -1496,64 +1496,4 @@ mod tests {
14961496
14971497 assert_eq ! ( expected_flags, actual_flags) ;
14981498 }
1499-
1500- #[ test]
1501- fn test_find_shader_libraries_only_in_allowed_dirs ( ) {
1502- let mut fs = FakeFs :: new ( ) ;
1503-
1504- for sub in [ "compute" , "graphics" , "mixed" ] . iter ( ) {
1505- let base = PathBuf :: from ( "pipelines" ) . join ( sub) . join ( "test" ) ;
1506- fs. add_dir ( base. join ( "src" ) ) ;
1507- fs. add_file ( base. join ( "Cargo.toml" ) , "dummy" . to_string ( ) ) ;
1508- let lib_rs = "\
1509- #[spirv(vertex)]
1510- #[spirv(fragment)]
1511- // compile-flags: -flag1, -flag2
1512- // dispatch: 1, 1, 1
1513- " ;
1514- fs. add_file ( base. join ( "src/lib.rs" ) , lib_rs. to_string ( ) ) ;
1515- fs. add_file ( base. join ( "vertex.wgsl" ) , "vertex shader" . to_string ( ) ) ;
1516- fs. add_file ( base. join ( "fragment.wgsl" ) , "fragment shader" . to_string ( ) ) ;
1517- }
1518-
1519- let disallowed = PathBuf :: from ( "pipelines" ) . join ( "other" ) . join ( "ignored" ) ;
1520- fs. add_dir ( disallowed. join ( "src" ) ) ;
1521- fs. add_file ( disallowed. join ( "Cargo.toml" ) , "dummy" . to_string ( ) ) ;
1522- fs. add_file ( disallowed. join ( "src/lib.rs" ) , "ignored" . to_string ( ) ) ;
1523-
1524- let default_regex = Regex :: new ( DEFAULT_REGEX_STR ) . unwrap ( ) ;
1525- let compute_output_regex = Regex :: new ( COMPUTE_OUTPUT_REGEX_STR ) . unwrap ( ) ;
1526- let dispatch_regex = Regex :: new ( DISPATCH_REGEX_STR ) . unwrap ( ) ;
1527- let vertex_regex = Regex :: new ( SPIRV_VERTEX_REGEX ) . unwrap ( ) ;
1528- let fragment_regex = Regex :: new ( SPIRV_FRAGMENT_REGEX ) . unwrap ( ) ;
1529- let compute_regex = Regex :: new ( SPIRV_COMPUTE_REGEX ) . unwrap ( ) ;
1530-
1531- let mut libraries = Vec :: new ( ) ;
1532- for sub in [ "compute" , "graphics" , "mixed" ] . iter ( ) {
1533- let dir = PathBuf :: from ( "pipelines" ) . join ( sub) ;
1534- if fs. exists ( & dir) {
1535- libraries. extend (
1536- find_shader_libraries (
1537- & fs,
1538- & dir,
1539- & default_regex,
1540- & compute_output_regex,
1541- & dispatch_regex,
1542- & vertex_regex,
1543- & fragment_regex,
1544- & compute_regex,
1545- )
1546- . unwrap ( ) ,
1547- ) ;
1548- }
1549- }
1550- assert_eq ! ( libraries. len( ) , 3 ) ;
1551- for lib in libraries {
1552- assert ! (
1553- lib. path. to_string_lossy( ) . contains( "/compute/" )
1554- || lib. path. to_string_lossy( ) . contains( "/graphics/" )
1555- || lib. path. to_string_lossy( ) . contains( "/mixed/" )
1556- ) ;
1557- }
1558- }
15591499}
0 commit comments