This repository was archived by the owner on May 28, 2025. It is now read-only.
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
22
22
fn extend ( & mut self , data : & [ u8 ] , exclude_from_len : & [ String ] ) {
23
23
let new_self = match * self {
24
24
ProcOutput :: Full { ref mut bytes, ref mut excluded_len } => {
25
+ let old_len = bytes. len ( ) ;
25
26
bytes. extend_from_slice ( data) ;
26
27
27
28
// 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
37
38
// the configured threshold.
38
39
for pattern in exclude_from_len {
39
40
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 ) ) ..] )
41
45
. windows ( pattern_bytes. len ( ) )
42
46
. filter ( |window| window == & pattern_bytes)
43
47
. count ( ) ;
You can’t perform that action at this time.
0 commit comments