File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ pub fn read2_abbreviated(mut child: Child, exclude_from_len: &[String]) -> io::R
2222 fn extend ( & mut self , data : & [ u8 ] , exclude_from_len : & [ String ] ) {
2323 let new_self = match * self {
2424 ProcOutput :: Full { ref mut bytes, ref mut excluded_len } => {
25+ let old_len = bytes. len ( ) ;
2526 bytes. extend_from_slice ( data) ;
2627
2728 // We had problems in the past with tests failing only in some environments,
@@ -37,7 +38,10 @@ pub fn read2_abbreviated(mut child: Child, exclude_from_len: &[String]) -> io::R
3738 // the configured threshold.
3839 for pattern in exclude_from_len {
3940 let pattern_bytes = pattern. as_bytes ( ) ;
40- let matches = data
41+ // We start matching `pattern_bytes - 1` into the previously loaded data,
42+ // to account for the fact a pattern might be included across multiple
43+ // `extend` calls. Starting from `- 1` avoids double-counting patterns.
44+ let matches = ( & bytes[ ( old_len. saturating_sub ( pattern_bytes. len ( ) - 1 ) ) ..] )
4145 . windows ( pattern_bytes. len ( ) )
4246 . filter ( |window| window == & pattern_bytes)
4347 . count ( ) ;
You can’t perform that action at this time.
0 commit comments