forked from typetools/checker-framework-inference
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCFInferenceTest.java
More file actions
81 lines (64 loc) · 2.48 KB
/
CFInferenceTest.java
File metadata and controls
81 lines (64 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package checkers.inference.test;
import org.checkerframework.framework.test.CheckerFrameworkPerFileTest;
import org.checkerframework.framework.test.TestUtilities;
import org.checkerframework.javacutil.SystemUtil;
import org.junit.Test;
import org.plumelib.util.IPair;
import org.plumelib.util.SystemPlume;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.AbstractProcessor;
public abstract class CFInferenceTest extends CheckerFrameworkPerFileTest {
public static final boolean isAtMost7Jvm;
static {
isAtMost7Jvm = SystemUtil.jreVersion <= 7;
}
public CFInferenceTest(
File testFile,
Class<? extends AbstractProcessor> checker,
String testDir,
String... checkerOptions) {
super(testFile, checker, testDir, checkerOptions);
}
public boolean useHacks() {
return SystemPlume.getBooleanSystemProperty("use.hacks");
}
public boolean makeDefaultsExplicit() {
return false;
}
public abstract IPair<String, List<String>> getSolverNameAndOptions();
public List<String> getAdditionalInferenceOptions() {
return new ArrayList<String>();
}
public String getPathToAfuScripts() {
return System.getProperty("path.afu.scripts");
}
public String getPathToInferenceScript() {
return System.getProperty("path.inference.script");
}
@Override
@Test
public void run() {
boolean shouldEmitDebugInfo = TestUtilities.getShouldEmitDebugInfo();
IPair<String, List<String>> solverArgs = getSolverNameAndOptions();
final File testDataDir = new File("testdata");
InferenceTestConfiguration config =
InferenceTestConfigurationBuilder.buildDefaultConfiguration(
testDir,
testFile,
testDataDir,
checker,
checkerOptions,
getAdditionalInferenceOptions(),
solverArgs.first,
solverArgs.second,
useHacks(),
makeDefaultsExplicit(),
shouldEmitDebugInfo,
getPathToAfuScripts(),
getPathToInferenceScript());
InferenceTestResult testResult = new InferenceTestExecutor().runTest(config);
InferenceTestUtilities.assertResultsAreValid(testResult);
}
}