@@ -17,10 +17,16 @@ pub(super) struct DebuggerCommands {
1717 check_lines : Vec < ( LineNumber , String ) > ,
1818 /// Source file name
1919 file : Utf8PathBuf ,
20+ /// The revision being tested, if any
21+ revision : Option < String > ,
2022}
2123
2224impl DebuggerCommands {
23- pub fn parse_from ( file : & Utf8Path , debugger_prefix : & str ) -> Result < Self , String > {
25+ pub fn parse_from (
26+ file : & Utf8Path ,
27+ debugger_prefix : & str ,
28+ test_revision : Option < & str > ,
29+ ) -> Result < Self , String > {
2430 let command_directive = format ! ( "{debugger_prefix}-command" ) ;
2531 let check_directive = format ! ( "{debugger_prefix}-check" ) ;
2632
@@ -41,6 +47,10 @@ impl DebuggerCommands {
4147 continue ;
4248 } ;
4349
50+ if !directive. applies_to_test_revision ( test_revision) {
51+ continue ;
52+ }
53+
4454 if directive. name == command_directive
4555 && let Some ( command) = directive. value_after_colon ( )
4656 {
@@ -53,7 +63,13 @@ impl DebuggerCommands {
5363 }
5464 }
5565
56- Ok ( Self { commands, breakpoint_lines, check_lines, file : file. to_path_buf ( ) } )
66+ Ok ( Self {
67+ commands,
68+ breakpoint_lines,
69+ check_lines,
70+ file : file. to_path_buf ( ) ,
71+ revision : test_revision. map ( str:: to_owned) ,
72+ } )
5773 }
5874
5975 /// Given debugger output and lines to check, ensure that every line is
@@ -85,9 +101,11 @@ impl DebuggerCommands {
85101 Ok ( ( ) )
86102 } else {
87103 let fname = self . file . file_name ( ) . unwrap ( ) ;
104+ let revision_suffix =
105+ self . revision . as_ref ( ) . map_or ( String :: new ( ) , |r| format ! ( "#{}" , r) ) ;
88106 let mut msg = format ! (
89- "check directive(s) from `{}` not found in debugger output. errors:" ,
90- self . file
107+ "check directive(s) from `{}{} ` not found in debugger output. errors:" ,
108+ self . file, revision_suffix
91109 ) ;
92110
93111 for ( src_lineno, err_line) in missing {
0 commit comments