Search in sources :

Example 1 with CompositeAnalysisResult

use of jkind.api.results.CompositeAnalysisResult 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();
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Program(jkind.lustre.Program) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) EphemeralImplementationUtil(com.rockwellcollins.atc.agree.analysis.EphemeralImplementationUtil) AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) IHandlerService(org.eclipse.ui.handlers.IHandlerService) AgreeASTBuilder(com.rockwellcollins.atc.agree.analysis.ast.AgreeASTBuilder) SystemInstance(org.osate.aadl2.instance.SystemInstance) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException)

Example 2 with CompositeAnalysisResult

use of jkind.api.results.CompositeAnalysisResult 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;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult)

Example 3 with CompositeAnalysisResult

use of jkind.api.results.CompositeAnalysisResult in project AGREE by loonwerks.

the class VerifyHandler method clearView.

protected void clearView() {
    getWindow().getShell().getDisplay().syncExec(() -> {
        try {
            TestCaseGeneratorResultsView page = (TestCaseGeneratorResultsView) getWindow().getActivePage().showView(TestCaseGeneratorResultsView.ID);
            page.setInput(new CompositeAnalysisResult("empty"), null);
        } catch (PartInitException e) {
            e.printStackTrace();
        }
    });
}
Also used : TestCaseGeneratorResultsView(com.rockwellcollins.atc.tcg.views.TestCaseGeneratorResultsView) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) PartInitException(org.eclipse.ui.PartInitException)

Example 4 with CompositeAnalysisResult

use of jkind.api.results.CompositeAnalysisResult in project AMASE by loonwerks.

the class IvcToFTGenerator method generateFT.

public FaultTree generateFT(AnalysisResult result, AgreeResultsLinker linker) {
    // initialize
    MHSUtils.clearLocals();
    // get current verification result
    AnalysisResult curResult = ((CompositeAnalysisResult) result).getChildren().get(0);
    walkthroughResults(curResult, null, linker);
    // some node's child nodes were added before those child nodes obtained their own child nodes
    // fix those discrepancies in the traverse
    faultTree.updateChildNodes();
    // sort through intermediate nodes to declare before use
    faultTree.sortIntermediateNodes();
    return faultTree;
}
Also used : AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult)

Example 5 with CompositeAnalysisResult

use of jkind.api.results.CompositeAnalysisResult in project AMASE by loonwerks.

the class GenMCSHandler 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("");
        // SystemType sysType = si.getSystemImplementation().getType();
        ComponentType sysType = AgreeUtils.getInstanceType(si);
        EList<AnnexSubclause> annexSubClauses = AnnexUtil.getAllAnnexSubclauses(sysType, AgreePackage.eINSTANCE.getAgreeContractSubclause());
        if (annexSubClauses.size() == 0) {
            throw new AgreeException("There is not an AGREE annex in the '" + sysType.getName() + "' system type.");
        }
        if (isRecursive()) {
            if (AgreeUtils.usingKind2()) {
                throw new AgreeException("Kind2 only supports monolithic verification");
            }
            result = buildAnalysisResult(((NamedElement) root).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 {
            wrapVerificationResult(si, wrapper);
            result = wrapper;
        }
        showView(result, linker);
        return doAnalysis(root, monitor, result, linker);
    } catch (Throwable e) {
        String messages = getNestedMessages(e);
        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
    } finally {
        implUtil.cleanup();
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ComponentType(org.osate.aadl2.ComponentType) Program(jkind.lustre.Program) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) EphemeralImplementationUtil(com.rockwellcollins.atc.agree.analysis.EphemeralImplementationUtil) AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) IHandlerService(org.eclipse.ui.handlers.IHandlerService) AgreeASTBuilder(com.rockwellcollins.atc.agree.analysis.ast.AgreeASTBuilder) SystemInstance(org.osate.aadl2.instance.SystemInstance) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) NamedElement(org.osate.aadl2.NamedElement) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Aggregations

CompositeAnalysisResult (jkind.api.results.CompositeAnalysisResult)12 AnalysisResult (jkind.api.results.AnalysisResult)9 ComponentImplementation (org.osate.aadl2.ComponentImplementation)7 AgreeException (com.rockwellcollins.atc.agree.analysis.AgreeException)4 EphemeralImplementationUtil (com.rockwellcollins.atc.agree.analysis.EphemeralImplementationUtil)4 AgreeASTBuilder (com.rockwellcollins.atc.agree.analysis.ast.AgreeASTBuilder)4 AgreeProgram (com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram)4 Program (jkind.lustre.Program)4 IStatus (org.eclipse.core.runtime.IStatus)4 Status (org.eclipse.core.runtime.Status)4 PartInitException (org.eclipse.ui.PartInitException)4 IHandlerService (org.eclipse.ui.handlers.IHandlerService)4 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)4 SystemInstance (org.osate.aadl2.instance.SystemInstance)4 AgreeResultsView (com.rockwellcollins.atc.agree.analysis.views.AgreeResultsView)2 SafetyResultsView (edu.umn.cs.crisys.safety.analysis.views.SafetyResultsView)2 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 GuaranteeStatement (com.rockwellcollins.atc.agree.agree.GuaranteeStatement)1 Activator (com.rockwellcollins.atc.agree.analysis.Activator)1