1515import java .util .Scanner ;
1616import static java .util .logging .Level .INFO ;
1717import java .util .logging .Logger ;
18+ import java .util .regex .Matcher ;
19+ import java .util .regex .Pattern ;
1820import javax .xml .parsers .DocumentBuilder ;
1921import javax .xml .parsers .DocumentBuilderFactory ;
2022import javax .xml .parsers .ParserConfigurationException ;
@@ -134,7 +136,7 @@ private void addValgrindOutput() throws FileNotFoundException {
134136 outputs [i ] = "" ;
135137 }
136138
137- Pattern errpat = Pattern .compile ("ERROR SUMMARY: ([0-9]+)" );
139+ Pattern errorPattern = Pattern .compile ("ERROR SUMMARY: ([0-9]+)" );
138140
139141 String line = scanner .nextLine ();
140142 int firstPID = parsePID (line );
@@ -149,7 +151,7 @@ private void addValgrindOutput() throws FileNotFoundException {
149151 parentOutput += "\n " + line ;
150152 } else {
151153 outputs [findIndex (pid , pids )] += "\n " + line ;
152- Matcher m = errpat .matcher (line );
154+ Matcher m = errorPattern .matcher (line );
153155 if (m .find ()) {
154156 errors [findIndex (pid , pids )] = Integer .parseInt (m .group (1 ));
155157 }
@@ -158,9 +160,10 @@ private void addValgrindOutput() throws FileNotFoundException {
158160 scanner .close ();
159161
160162 for (int i = 0 ; i < outputs .length ; i ++) {
161- if (errors [i ] == 0 ) {
162- outputs [i ] = "" ;
163- }
163+ if (errors [i ] == 0 ) {
164+ // Workaround for a bug where any valgrind output is considered a potential error.
165+ outputs [i ] = "" ;
166+ }
164167 tests .get (i ).setValgrindTrace (outputs [i ]);
165168 }
166169 }
0 commit comments