use of org.jacoco.core.data.ExecutionData in project bazel by bazelbuild.
the class BranchDetailAnalyzer method analyzeClass.
@Override
public void analyzeClass(final ClassReader reader) {
final Map<Integer, BranchExp> lineToBranchExp = mapProbes(reader);
long classid = CRC64.checksum(reader.b);
ExecutionData classData = executionData.get(classid);
if (classData == null) {
return;
}
boolean[] probes = classData.getProbes();
BranchCoverageDetail detail = new BranchCoverageDetail();
for (Map.Entry<Integer, BranchExp> entry : lineToBranchExp.entrySet()) {
int line = entry.getKey();
BranchExp branchExp = entry.getValue();
List<CovExp> branches = branchExp.getBranches();
detail.setBranches(line, branches.size());
for (int branchIdx = 0; branchIdx < branches.size(); branchIdx++) {
if (branches.get(branchIdx).eval(probes)) {
detail.setTakenBit(line, branchIdx);
}
}
}
if (detail.linesWithBranches().size() > 0) {
branchDetails.put(reader.getClassName(), detail);
}
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class MergeTest method createExecFile.
private File createExecFile(String name) throws IOException {
File file = new File(tmp.getRoot(), name + ".exec");
final FileOutputStream execout = new FileOutputStream(file);
ExecutionDataWriter writer = new ExecutionDataWriter(execout);
writer.visitClassExecution(new ExecutionData(name.hashCode(), name, new boolean[] { true }));
execout.close();
return file;
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class MergeTest method loadExecFile.
private Set<String> loadExecFile(File file) throws IOException {
ExecFileLoader loader = new ExecFileLoader();
loader.load(file);
Set<String> names = new HashSet<String>();
for (ExecutionData d : loader.getExecutionDataStore().getContents()) {
names.add(d.getName());
}
return names;
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class ExecInfo method dump.
private void dump(final File file, final PrintWriter out) throws IOException {
out.printf("[INFO] Loading exec file %s.%n", file);
out.println("CLASS ID HITS/PROBES CLASS NAME");
final FileInputStream in = new FileInputStream(file);
final ExecutionDataReader reader = new ExecutionDataReader(in);
reader.setSessionInfoVisitor(new ISessionInfoVisitor() {
public void visitSessionInfo(final SessionInfo info) {
out.printf("Session \"%s\": %s - %s%n", info.getId(), new Date(info.getStartTimeStamp()), new Date(info.getDumpTimeStamp()));
}
});
reader.setExecutionDataVisitor(new IExecutionDataVisitor() {
public void visitClassExecution(final ExecutionData data) {
out.printf("%016x %3d of %3d %s%n", Long.valueOf(data.getId()), Integer.valueOf(getHitCount(data.getProbes())), Integer.valueOf(data.getProbes().length), data.getName());
}
});
reader.read();
in.close();
out.println();
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class XMLFormatterTest method setup.
@Before
public void setup() {
driver = new ReportStructureTestDriver();
formatter = new XMLFormatter();
output = new MemoryOutput();
infos = new ArrayList<SessionInfo>();
data = new ArrayList<ExecutionData>();
}
Aggregations