Skip to content

Commit ddd49f4

Browse files
mparteljamo
authored andcommitted
Minor cleanups to PR #98.
1 parent 7781532 commit ddd49f4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/data/serialization/cresultparser/CTestResultParser.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import java.util.Scanner;
1616
import static java.util.logging.Level.INFO;
1717
import java.util.logging.Logger;
18+
import java.util.regex.Matcher;
19+
import java.util.regex.Pattern;
1820
import javax.xml.parsers.DocumentBuilder;
1921
import javax.xml.parsers.DocumentBuilderFactory;
2022
import 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

Comments
 (0)