protected JSCallGraph runTest(URL url, Object[][] assertions, BuilderType... builderTypes) throws WalaException, Error, CancelException { JSCallGraph cg = null; for(BuilderType builderType : builderTypes) { ProgressMaster monitor = ProgressMaster.make(new NullProgressMonitor(), 45000, true); try { cg = util.buildCG(url, builderType, monitor, false, DefaultSourceExtractor.factory).fst; System.err.println(cg); verifyGraphAssertions(cg, assertions); } catch(AssertionError afe) { throw new AssertionError(builderType + ": " + afe.getMessage()); } } return cg; }
/** * builds a call graph, and sets the corresponding heap model for analysis */ private static Pair<CallGraph, PointerAnalysis<InstanceKey>> buildCallGraph(AnalysisScope scope, ClassHierarchy cha, AnalysisOptions options) throws IllegalArgumentException, CancelException { CallGraph retCG = null; PointerAnalysis<InstanceKey> retPA = null; final IAnalysisCacheView cache = new AnalysisCacheImpl(); CallGraphBuilder<InstanceKey> builder; if (CHEAP_CG) { builder = Util.makeZeroCFABuilder(Language.JAVA, options, cache, cha, scope); // we want vanilla 0-1 CFA, which has one abstract loc per allocation heapModel = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope); } else { builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope); heapModel = (HeapModel) builder; } ProgressMaster master = ProgressMaster.make(new NullProgressMonitor(), 360000, false); master.beginTask("runSolver", 1); try { retCG = builder.makeCallGraph(options, master); retPA = builder.getPointerAnalysis(); } catch (CallGraphBuilderCancelException e) { System.err.println("TIMED OUT!!"); retCG = e.getPartialCallGraph(); retPA = e.getPartialPointerAnalysis(); } return Pair.make(retCG, retPA); }
@Test(expected = CallGraphBuilderCancelException.class) public void testManyStrings() throws IllegalArgumentException, IOException, CancelException, WalaException { SSAPropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "many-strings.js"); B.getOptions().setTraceStringConstants(true); ProgressMaster monitor = ProgressMaster.make(new NullProgressMonitor(), 10000, false); monitor.beginTask("build CG", 1); CallGraph CG = B.makeCallGraph(B.getOptions(), monitor); monitor.done(); CAstCallGraphUtil.dumpCG(B.getCFAContextInterpreter(), B.getPointerAnalysis(), CG); }
ProgressMaster master = ProgressMaster.make(new NullProgressMonitor(), timeout * 1000, false); if (timeout > 0) { master.beginTask("runSolver", 1);