Skip to content

Commit

Permalink
Add call graph logging to test.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Nov 22, 2023
1 parent 2ef7295 commit 4582417
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
import com.ibm.wala.cast.python.client.PythonAnalysisEngine;
import com.ibm.wala.cast.python.ipa.callgraph.PythonSSAPropagationCallGraphBuilder;
import com.ibm.wala.cast.python.ml.analysis.TensorTypeAnalysis;
Expand All @@ -12,6 +13,7 @@
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.util.CancelException;
import java.io.IOException;
Expand All @@ -23,6 +25,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.junit.Test;
Expand Down Expand Up @@ -235,10 +238,14 @@ private void testTf2(
CallGraph CG = builder.makeCallGraph(builder.getOptions());
assertNotNull(CG);

// CAstCallGraphUtil.AVOID_DUMP = false;
// CAstCallGraphUtil.dumpCG(((SSAPropagationCallGraphBuilder)builder).getCFAContextInterpreter(),
// builder.getPointerAnalysis(), CG);
// System.err.println(CG);
if (logger.isLoggable(Level.FINE)) {
CAstCallGraphUtil.AVOID_DUMP = false;
CAstCallGraphUtil.dumpCG(
((SSAPropagationCallGraphBuilder) builder).getCFAContextInterpreter(),
builder.getPointerAnalysis(),
CG);
logger.fine("Call graph:\n" + CG);
}

TensorTypeAnalysis analysis = E.performAnalysis(builder);

Expand Down

0 comments on commit 4582417

Please sign in to comment.