use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.
the class TestCaseGeneratorMenuListener method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
IStructuredSelection selection = (IStructuredSelection) table.getViewer().getSelection();
if (!selection.isEmpty()) {
AnalysisResult result = (AnalysisResult) selection.getFirstElement();
addLinkedMenus(manager, result);
}
}
use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.
the class VerifyHandler method runJob.
@Override
protected IStatus runJob(Element root, IProgressMonitor monitor) {
EphemeralImplementationUtil implUtil = new EphemeralImplementationUtil(monitor);
// this flag is set by the rerun handler to prevent clearing the advice map
if (!calledFromRerun) {
rerunAdviceMap.clear();
}
calledFromRerun = false;
disableRerunHandler();
handlerService = getWindow().getService(IHandlerService.class);
try {
// Make sure the user selected a component implementation
ComponentImplementation ci = getComponentImplementation(root, implUtil);
SystemInstance si = getSysInstance(ci, implUtil);
AnalysisResult result;
CompositeAnalysisResult wrapper = new CompositeAnalysisResult("");
if (isRecursive()) {
if (AgreeUtils.usingKind2()) {
throw new AgreeException("Kind2 only supports monolithic verification");
}
result = buildAnalysisResult(ci.getName(), si);
wrapper.addChild(result);
result = wrapper;
} else if (isRealizability()) {
AgreeProgram agreeProgram = new AgreeASTBuilder().getAgreeProgram(si, false);
Program program = LustreAstBuilder.getRealizabilityLustreProgram(agreeProgram);
wrapper.addChild(createVerification("Realizability Check", si, program, agreeProgram, AnalysisType.Realizability));
result = wrapper;
} else {
CompositeAnalysisResult wrapperTop = new CompositeAnalysisResult("Verification for " + ci.getName());
wrapVerificationResult(si, wrapperTop);
wrapper.addChild(wrapperTop);
result = wrapper;
}
showView(result, linker);
return doAnalysis(ci, monitor);
} catch (Throwable e) {
String messages = getNestedMessages(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
} finally {
implUtil.cleanup();
}
}
use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.
the class VerifyHandler method buildAnalysisResult.
protected AnalysisResult buildAnalysisResult(String name, ComponentInstance ci) {
CompositeAnalysisResult result = new CompositeAnalysisResult("Verification for " + name);
if (containsAGREEAnnex(ci)) {
wrapVerificationResult(ci, result);
ComponentImplementation compImpl = AgreeUtils.getInstanceImplementation(ci);
for (ComponentInstance subInst : ci.getComponentInstances()) {
if (AgreeUtils.getInstanceImplementation(subInst) != null) {
AnalysisResult buildAnalysisResult = buildAnalysisResult(subInst.getName(), subInst);
if (buildAnalysisResult != null) {
result.addChild(buildAnalysisResult);
}
}
}
if (result.getChildren().size() != 0) {
linker.setComponent(result, compImpl);
return result;
}
}
return null;
}
use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.
the class AgreeMenuListener method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
IStructuredSelection selection = (IStructuredSelection) tree.getViewer().getSelection();
if (!selection.isEmpty()) {
AnalysisResult result = (AnalysisResult) selection.getFirstElement();
addLinkedMenus(manager, result);
}
}
use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.
the class AgreeFileUtil method printLog.
/**
* Prints the AGREE analysis result in json format to the property log file
* (specified in AGREE preferences), along with a timestamp and hashcode.
* @param result - The result of the AGREE analysis.
* @param timestamp - The time at which the analysis started
* @param hash - The hashcode for the combined model files
*/
public static void printLog(JKindResult result, long timestamp, String hashcode) {
if (hashcode == null) {
return;
}
try {
// This class could be called concurrently from multiple threads
// so wrap the following read/write behavior in a mutex
mutex.acquire();
try {
// Figure out the top-level analysis this result is part of
// and keep track of ancestor trace so we know where to insert this analysis
AnalysisResult topLevelAnalysis = result;
List<String> ancestorTrace = new ArrayList<>();
while (topLevelAnalysis.getParent() != null && !topLevelAnalysis.getParent().getName().isEmpty()) {
topLevelAnalysis = topLevelAnalysis.getParent();
ancestorTrace.add(0, topLevelAnalysis.getName());
}
// Get the results from the current agree analysis
AgreeLogResult agreeLogResult = parsePropertyResult(result);
agreeLogResult.setTimestamp(timestamp);
agreeLogResult.setHashcode(hashcode);
// Read in the agree property log file
List<AgreeLogResult> agreeLog = readAgreeLog();
// Insert the agree result in the agree log structure
insertAgreeLogResult(agreeLogResult, agreeLog, ancestorTrace);
// Write the agree property results back to the file
// The contents of the file will be overwritten
writeAgreeLog(agreeLog);
} finally {
mutex.release();
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("Could not write to the AGREE analysis log.\n");
}
return;
}
Aggregations