Skip to content

Commit 7781532

Browse files
committed
Remove invalid Valgrind messages for tests with no Valgrind errors.
1 parent 0edd062 commit 7781532

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,13 @@ private void addValgrindOutput() throws FileNotFoundException {
129129
String parentOutput = ""; // Contains total amount of memory used and such things. Useful if we later want to add support for testing memory usage
130130
String[] outputs = new String[tests.size()];
131131
int[] pids = new int[tests.size()];
132+
int[] errors = new int[tests.size()];
132133
for (int i = 0; i < outputs.length; i++) {
133134
outputs[i] = "";
134135
}
135136

137+
Pattern errpat = Pattern.compile("ERROR SUMMARY: ([0-9]+)");
138+
136139
String line = scanner.nextLine();
137140
int firstPID = parsePID(line);
138141
parentOutput += "\n" + line;
@@ -146,11 +149,18 @@ private void addValgrindOutput() throws FileNotFoundException {
146149
parentOutput += "\n" + line;
147150
} else {
148151
outputs[findIndex(pid, pids)] += "\n" + line;
152+
Matcher m = errpat.matcher(line);
153+
if (m.find()) {
154+
errors[findIndex(pid, pids)] = Integer.parseInt(m.group(1));
155+
}
149156
}
150157
}
151158
scanner.close();
152159

153160
for (int i = 0; i < outputs.length; i++) {
161+
if (errors[i] == 0) {
162+
outputs[i] = "";
163+
}
154164
tests.get(i).setValgrindTrace(outputs[i]);
155165
}
156166
}

0 commit comments

Comments
 (0)