undo WalaTestCase extending TestCase; dependent projects will have to be switched to JUnit 4. Also, more optimizations.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3742 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2009-07-27 22:43:06 +00:00
parent f8c06cc6ef
commit 93a4571961
7 changed files with 81 additions and 74 deletions

View File

@ -40,10 +40,6 @@ public class GraphDataflowTest extends WalaTestCase {
public static final String nodeNames = "ABCDEFGH";
protected final static String[] nodes = new String[nodeNames.length()];
public GraphDataflowTest() {
super("GraphDataflowTest");
}
/**
* A simple test of the GraphBitVectorDataflow system
* @throws CancelException

View File

@ -60,13 +60,6 @@ import com.ibm.wala.util.intset.SparseLongSet;
*/
public class PrimitivesTest extends WalaTestCase {
public PrimitivesTest() {
super("PrimitivesTest");
}
public PrimitivesTest(String arg0) {
super(arg0);
}
/**
* Test the MutableSparseIntSet implementation

View File

@ -32,7 +32,6 @@ public class CallGraphTestUtil {
private static final ClassLoader MY_CLASSLOADER = CallGraphTestUtil.class.getClassLoader();
public static AnalysisOptions makeAnalysisOptions(AnalysisScope scope, Iterable<Entrypoint> entrypoints) {
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
return options;
@ -40,6 +39,11 @@ public class CallGraphTestUtil {
public static String REGRESSION_EXCLUSIONS = "Java60RegressionExclusions.txt";
/**
* should we check the heap footprint before and after CG construction?
*/
private static final boolean CHECK_FOOTPRINT = false;
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile, String exclusionsFile) throws IOException {
AnalysisScope scope = AnalysisScopeReader.readJavaScope(scopeFile, FileProvider.getFile(exclusionsFile), MY_CLASSLOADER);
return scope;
@ -47,21 +51,29 @@ public class CallGraphTestUtil {
public static CallGraph buildRTA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha, AnalysisScope scope)
throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build RTA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeRTABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}
public static CallGraph buildZeroCFA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha, AnalysisScope scope,
boolean testPAtoString) throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build ZeroCFA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
@ -69,28 +81,38 @@ public class CallGraphTestUtil {
builder.getPointerAnalysis().toString();
}
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}
public static CallGraph buildVanillaZeroOneCFA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha,
AnalysisScope scope) throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build Vanilla 0-1-CFA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}
public static CallGraph buildZeroOneCFA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha, AnalysisScope scope,
boolean testPAtoString) throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build 0-1-CFA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
@ -98,34 +120,46 @@ public class CallGraphTestUtil {
builder.getPointerAnalysis().toString();
}
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}
public static CallGraph buildZeroContainerCFA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha,
AnalysisScope scope) throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build 0-1-Container-CFA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeZeroContainerCFABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}
public static CallGraph buildZeroOneContainerCFA(AnalysisOptions options, AnalysisCache cache, ClassHierarchy cha,
AnalysisScope scope) throws IllegalArgumentException, CancelException {
StopwatchGC S = new StopwatchGC("build 0-1-Container-CFA graph");
S.start();
StopwatchGC S = null;
if (CHECK_FOOTPRINT) {
S = new StopwatchGC("build RTA graph");
S.start();
}
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
CallGraph cg = builder.makeCallGraph(options, null);
S.stop();
System.err.println(S.report());
if (CHECK_FOOTPRINT) {
S.stop();
System.err.println(S.report());
}
return cg;
}

View File

@ -12,9 +12,9 @@ package com.ibm.wala.core.tests.cha;
import java.util.Collection;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.ibm.wala.classLoader.ClassLoaderFactory;
@ -38,15 +38,15 @@ public class GetTargetsTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = GetTargetsTest.class.getClassLoader();
private AnalysisScope scope;
private ClassHierarchy cha;
private static AnalysisScope scope;
private static ClassHierarchy cha;
public static void main(String[] args) {
justThisTest(GetTargetsTest.class);
}
@Before
public void setUp() throws Exception {
@BeforeClass
public static void beforeClass() throws Exception {
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
@ -64,8 +64,8 @@ public class GetTargetsTest extends WalaTestCase {
*
* @see junit.framework.TestCase#tearDown()
*/
@After
public void tearDown() throws Exception {
@AfterClass
public static void afterClass() throws Exception {
scope = null;
cha = null;
}

View File

@ -12,9 +12,9 @@ package com.ibm.wala.core.tests.ir;
import java.util.Iterator;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.ibm.wala.classLoader.ClassLoaderFactory;
@ -50,20 +50,20 @@ public class DeterministicIRTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = DeterministicIRTest.class.getClassLoader();
private AnalysisScope scope;
private static AnalysisScope scope;
private ClassHierarchy cha;
private static ClassHierarchy cha;
private AnalysisOptions options;
private static AnalysisOptions options;
private AnalysisCache cache;
private static AnalysisCache cache;
public static void main(String[] args) {
justThisTest(DeterministicIRTest.class);
}
@Before
public void setUp() throws Exception {
@BeforeClass
public static void beforeClass() throws Exception {
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
FileProvider.getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
@ -78,11 +78,13 @@ public class DeterministicIRTest extends WalaTestCase {
}
}
@After
public void tearDown() throws Exception {
@AfterClass
public static void afterClass() throws Exception {
Warnings.clear();
scope = null;
cha = null;
options = null;
cache = null;
}
/**

View File

@ -50,12 +50,7 @@ public class MultiDimArrayTest extends WalaTestCase {
justThisTest(MultiDimArrayTest.class);
}
/**
* @param arg0
*/
public MultiDimArrayTest(String arg0) {
super(arg0);
}
public MultiDimArrayTest() {

View File

@ -10,8 +10,6 @@
*******************************************************************************/
package com.ibm.wala.core.tests.util;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -23,7 +21,7 @@ import com.ibm.wala.util.warnings.Warnings;
/**
* Simple extension to JUnit test case.
*/
public abstract class WalaTestCase extends TestCase {
public abstract class WalaTestCase {
final private static boolean ANALYZE_LEAKS = false;
@ -62,17 +60,6 @@ public abstract class WalaTestCase extends TestCase {
JUnitCore.runClasses(testClass);
}
/**
* @param arg0
*/
public WalaTestCase(String arg0) {
super(arg0);
}
public WalaTestCase() {
this("WalaTestCase");
}
protected static void assertBound(String tag, double quantity, double bound) {
String msg = tag + ", quantity: " + quantity + ", bound:" + bound;
System.err.println(msg);