Skip to content
Snippets Groups Projects
Commit 92fea41d authored by Florian Angerer's avatar Florian Angerer
Browse files

Implemented configure error detector for package test analyzer.

parent cb57197a
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import java.util.Date;
import java.util.LinkedList;
import java.util.logging.Logger;
import com.oracle.truffle.r.test.packages.analyzer.detectors.ConfigureErrorDetector;
import com.oracle.truffle.r.test.packages.analyzer.detectors.DiffDetector;
import com.oracle.truffle.r.test.packages.analyzer.detectors.InstallationProblemDetector;
import com.oracle.truffle.r.test.packages.analyzer.detectors.RErrorDetector;
......@@ -152,8 +153,9 @@ public class FileTreeWalker {
lfParser.addDetector(RErrorDetector.INSTANCE);
lfParser.addDetector(UnsupportedSpecializationDetector.INSTANCE);
lfParser.addDetector(RInternalErrorDetector.INSTANCE);
lfParser.addTestResultDetector(DiffDetector.INSTANCE);
lfParser.addDetector(SymbolLookupErrorDetector.INSTANCE);
lfParser.addDetector(ConfigureErrorDetector.INSTANCE);
lfParser.addTestResultDetector(DiffDetector.INSTANCE);
LogFile parseLogFile = lfParser.parseLogFile();
Collection<Problem> problems = parseLogFile.collectProblems();
......
package com.oracle.truffle.r.test.packages.analyzer.detectors;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import com.oracle.truffle.r.test.packages.analyzer.Location;
import com.oracle.truffle.r.test.packages.analyzer.Problem;
import com.oracle.truffle.r.test.packages.analyzer.model.RPackageTestRun;
public class ConfigureErrorDetector extends LineDetector {
public static final ConfigureErrorDetector INSTANCE = new ConfigureErrorDetector();
private static final String PREFIX = "configure: error: ";
protected ConfigureErrorDetector() {
}
@Override
public String getName() {
return "Configure error detector";
}
@Override
public Collection<Problem> detect(RPackageTestRun pkgTestRun, Location startLocation, List<String> body) {
Collection<Problem> problems = new LinkedList<>();
assert body.isEmpty() || startLocation != null;
int lineNr = startLocation != null ? startLocation.lineNr : 0;
for (String line : body) {
if (line.startsWith(PREFIX)) {
String message = line.substring(PREFIX.length());
problems.add(new ConfigureErrorProblem(pkgTestRun, this, new Location(startLocation.file, lineNr), message));
}
++lineNr;
}
return problems;
}
public static class ConfigureErrorProblem extends Problem {
private final String message;
protected ConfigureErrorProblem(RPackageTestRun pkg, ConfigureErrorDetector detector, Location location, String message) {
super(pkg, detector, location);
this.message = message;
}
public String getMessage() {
return message;
}
@Override
public String toString() {
return getLocation() + ": configure: error: " + message;
}
@Override
public String getSummary() {
return "RInternalError";
}
@Override
public String getDetails() {
return message;
}
@Override
public int getSimilarityTo(Problem other) {
if (other.getClass() == ConfigureErrorProblem.class) {
return Problem.computeLevenshteinDistance(getDetails().trim(), other.getDetails().trim());
}
return Integer.MAX_VALUE;
}
@Override
public boolean isSimilarTo(Problem other) {
return getSimilarityTo(other) < 10;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment