@@ -16,10 +16,16 @@ pub(super) struct DebuggerCommands {
1616 check_lines : Vec < ( usize , String ) > ,
1717 /// Source file name
1818 file : Utf8PathBuf ,
19+ /// The revision being tested, if any
20+ revision : Option < String > ,
1921}
2022
2123impl DebuggerCommands {
22- pub fn parse_from ( file : & Utf8Path , debugger_prefix : & str ) -> Result < Self , String > {
24+ pub fn parse_from (
25+ file : & Utf8Path ,
26+ debugger_prefix : & str ,
27+ test_revision : Option < & str > ,
28+ ) -> Result < Self , String > {
2329 let command_directive = format ! ( "{debugger_prefix}-command" ) ;
2430 let check_directive = format ! ( "{debugger_prefix}-check" ) ;
2531
@@ -44,6 +50,10 @@ impl DebuggerCommands {
4450 continue ;
4551 } ;
4652
53+ if !directive. applies_to_test_revision ( test_revision) {
54+ continue ;
55+ }
56+
4757 if directive. name == command_directive
4858 && let Some ( command) = directive. value_after_colon ( )
4959 {
@@ -56,7 +66,13 @@ impl DebuggerCommands {
5666 }
5767 }
5868
59- Ok ( Self { commands, breakpoint_lines, check_lines, file : file. to_path_buf ( ) } )
69+ Ok ( Self {
70+ commands,
71+ breakpoint_lines,
72+ check_lines,
73+ file : file. to_path_buf ( ) ,
74+ revision : test_revision. map ( str:: to_owned) ,
75+ } )
6076 }
6177
6278 /// Given debugger output and lines to check, ensure that every line is
@@ -88,9 +104,11 @@ impl DebuggerCommands {
88104 Ok ( ( ) )
89105 } else {
90106 let fname = self . file . file_name ( ) . unwrap ( ) ;
107+ let revision_suffix =
108+ self . revision . as_ref ( ) . map_or ( String :: new ( ) , |r| format ! ( "#{}" , r) ) ;
91109 let mut msg = format ! (
92- "check directive(s) from `{}` not found in debugger output. errors:" ,
93- self . file
110+ "check directive(s) from `{}{} ` not found in debugger output. errors:" ,
111+ self . file, revision_suffix
94112 ) ;
95113
96114 for ( src_lineno, err_line) in missing {
0 commit comments