@@ -325,8 +325,8 @@ impl Validate for Output {
325325#[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
326326pub struct Compiler {
327327 pub path : PathBuf ,
328- #[ serde( default = "default_ignore_compiler " ) ]
329- pub ignore : Ignore , // FIXME: change this to bool
328+ #[ serde( default = "default_never_ignore " ) ]
329+ pub ignore : Ignore ,
330330 #[ serde( default ) ]
331331 pub arguments : Arguments ,
332332}
@@ -528,16 +528,16 @@ fn default_wrapper_directory() -> PathBuf {
528528
529529/// The default path to the wrapper executable.
530530fn default_wrapper_executable ( ) -> PathBuf {
531- PathBuf :: from ( PRELOAD_LIBRARY_PATH )
531+ PathBuf :: from ( WRAPPER_EXECUTABLE_PATH )
532532}
533533
534534/// The default path to the shared library that will be preloaded.
535535fn default_preload_library ( ) -> PathBuf {
536- PathBuf :: from ( WRAPPER_EXECUTABLE_PATH )
536+ PathBuf :: from ( PRELOAD_LIBRARY_PATH )
537537}
538538
539539/// The default don't ignore the compiler.
540- fn default_ignore_compiler ( ) -> Ignore {
540+ fn default_never_ignore ( ) -> Ignore {
541541 Ignore :: Never
542542}
543543
@@ -684,6 +684,60 @@ mod test {
684684 assert_eq ! ( expected, result) ;
685685 }
686686
687+ #[ test]
688+ fn test_incomplete_wrapper_config ( ) {
689+ let content: & [ u8 ] = br#"
690+ schema: 4.0
691+
692+ intercept:
693+ mode: wrapper
694+ executables:
695+ - /usr/bin/cc
696+ - /usr/bin/c++
697+ output:
698+ specification: clang
699+ filter:
700+ source:
701+ include_only_existing_files: true
702+ duplicates:
703+ by_fields:
704+ - file
705+ - directory
706+ format:
707+ command_as_array: true
708+ "# ;
709+
710+ let result = Main :: from_reader ( content) . unwrap ( ) ;
711+
712+ let expected = Main {
713+ intercept : Intercept :: Wrapper {
714+ path : default_wrapper_executable ( ) ,
715+ directory : default_wrapper_directory ( ) ,
716+ executables : vec_of_pathbuf ! [ "/usr/bin/cc" , "/usr/bin/c++" ] ,
717+ } ,
718+ output : Output :: Clang {
719+ compilers : vec ! [ ] ,
720+ filter : Filter {
721+ source : SourceFilter {
722+ include_only_existing_files : true ,
723+ paths_to_include : vec_of_pathbuf ! [ ] ,
724+ paths_to_exclude : vec_of_pathbuf ! [ ] ,
725+ } ,
726+ duplicates : DuplicateFilter {
727+ by_fields : vec ! [ OutputFields :: File , OutputFields :: Directory ] ,
728+ } ,
729+ } ,
730+ format : Format {
731+ command_as_array : true ,
732+ drop_output_field : false ,
733+ } ,
734+ } ,
735+ schema : String :: from ( "4.0" ) ,
736+ } ;
737+
738+ assert_eq ! ( expected, result) ;
739+ }
740+
687741 #[ test]
688742 fn test_preload_config ( ) {
689743 let content: & [ u8 ] = br#"
@@ -709,6 +763,83 @@ mod test {
709763 assert_eq ! ( expected, result) ;
710764 }
711765
766+ #[ test]
767+ fn test_incomplete_preload_config ( ) {
768+ let content: & [ u8 ] = br#"
769+ schema: 4.0
770+
771+ intercept:
772+ mode: preload
773+ output:
774+ specification: clang
775+ compilers:
776+ - path: /usr/local/bin/cc
777+ - path: /usr/local/bin/c++
778+ - path: /usr/local/bin/clang
779+ ignore: always
780+ - path: /usr/local/bin/clang++
781+ ignore: always
782+ filter:
783+ source:
784+ include_only_existing_files: false
785+ duplicates:
786+ by_fields:
787+ - file
788+ format:
789+ command_as_array: true
790+ drop_output_field: false
791+ "# ;
792+
793+ let result = Main :: from_reader ( content) . unwrap ( ) ;
794+
795+ let expected = Main {
796+ intercept : Intercept :: Preload {
797+ path : default_preload_library ( ) ,
798+ } ,
799+ output : Output :: Clang {
800+ compilers : vec ! [
801+ Compiler {
802+ path: PathBuf :: from( "/usr/local/bin/cc" ) ,
803+ ignore: Ignore :: Never ,
804+ arguments: Arguments :: default ( ) ,
805+ } ,
806+ Compiler {
807+ path: PathBuf :: from( "/usr/local/bin/c++" ) ,
808+ ignore: Ignore :: Never ,
809+ arguments: Arguments :: default ( ) ,
810+ } ,
811+ Compiler {
812+ path: PathBuf :: from( "/usr/local/bin/clang" ) ,
813+ ignore: Ignore :: Always ,
814+ arguments: Arguments :: default ( ) ,
815+ } ,
816+ Compiler {
817+ path: PathBuf :: from( "/usr/local/bin/clang++" ) ,
818+ ignore: Ignore :: Always ,
819+ arguments: Arguments :: default ( ) ,
820+ } ,
821+ ] ,
822+ filter : Filter {
823+ source : SourceFilter {
824+ include_only_existing_files : false ,
825+ paths_to_include : vec_of_pathbuf ! [ ] ,
826+ paths_to_exclude : vec_of_pathbuf ! [ ] ,
827+ } ,
828+ duplicates : DuplicateFilter {
829+ by_fields : vec ! [ OutputFields :: File ] ,
830+ } ,
831+ } ,
832+ format : Format {
833+ command_as_array : true ,
834+ drop_output_field : false ,
835+ } ,
836+ } ,
837+ schema : String :: from ( "4.0" ) ,
838+ } ;
839+
840+ assert_eq ! ( expected, result) ;
841+ }
842+
712843 #[ test]
713844 fn test_default_config ( ) {
714845 let result = Main :: default ( ) ;
0 commit comments