@@ -24,6 +24,9 @@ struct Opt {
2424
2525    #[ structopt( short,  long,  long_help = "Timeout in ms" ,  default_value = "5000" ) ]  
2626    timeout :  u64 , 
27+ 
28+     #[ structopt( short = "x" ,  long) ]  
29+     cobertura_xml :  bool , 
2730} 
2831
2932fn  main ( )  -> Result < ( ) >  { 
@@ -38,7 +41,7 @@ fn main() -> Result<()> {
3841        for  entry in  std:: fs:: read_dir ( dir) ? { 
3942            let  input = entry?. path ( ) ; 
4043
41-             println ! ( "testing input: {}" ,  input. display( ) ) ; 
44+             eprintln ! ( "testing input: {}" ,  input. display( ) ) ; 
4245
4346            let  cmd = input_command ( & opt. cmd ,  & input) ; 
4447            let  coverage = record ( & mut  cache,  filter. clone ( ) ,  cmd,  timeout) ?; 
@@ -48,7 +51,7 @@ fn main() -> Result<()> {
4851    } 
4952
5053    for  input in  & opt. inputs  { 
51-         println ! ( "testing input: {}" ,  input. display( ) ) ; 
54+         eprintln ! ( "testing input: {}" ,  input. display( ) ) ; 
5255
5356        let  cmd = input_command ( & opt. cmd ,  input) ; 
5457        let  coverage = record ( & mut  cache,  filter. clone ( ) ,  cmd,  timeout) ?; 
@@ -59,12 +62,17 @@ fn main() -> Result<()> {
5962    let  mut  debug_info = coverage:: debuginfo:: DebugInfo :: default ( ) ; 
6063    let  src_coverage = total. source_coverage ( & mut  debug_info) ?; 
6164
62-     for  file_coverage in  src_coverage. files  { 
63-         for  location in  & file_coverage. locations  { 
64-             println ! ( 
65-                 "{} {}:{}" , 
66-                 location. count,  file_coverage. file,  location. line
67-             ) ; 
65+     if  opt. cobertura_xml  { 
66+         let  cobertura = coverage:: cobertura:: cobertura ( src_coverage) ?; 
67+         println ! ( "{}" ,  cobertura) ; 
68+     }  else  { 
69+         for  file_coverage in  src_coverage. files  { 
70+             for  location in  & file_coverage. locations  { 
71+                 println ! ( 
72+                     "{} {}:{}" , 
73+                     location. count,  file_coverage. file,  location. line
74+                 ) ; 
75+             } 
6876        } 
6977    } 
7078
0 commit comments