Class AinferValidatePerDirectoryTest
java.lang.Object
org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest
org.checkerframework.framework.test.CheckerFrameworkWPIPerDirectoryTest
org.checkerframework.framework.test.AinferValidatePerDirectoryTest
A specialized variant of
CheckerFrameworkPerDirectoryTest
for testing the Whole Program
Inference feature of the Checker Framework, which is tested by running pairs of these tests: a
"generation test" (of class AinferGeneratePerDirectoryTest
) to do inference using the
-Ainfer
option, and a "validation test" (of this class) to check that files typecheck
after those inferences are taken into account.-
Field Summary
Fields inherited from class org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest
checkerNames, checkerOptions, classpathExtra, testDir, testFiles
-
Constructor Summary
ModifierConstructorDescriptionprotected
AinferValidatePerDirectoryTest
(List<File> testFiles, Class<? extends AbstractProcessor> checker, String checkerShortName, String testDir, Class<? extends AinferGeneratePerDirectoryTest> generationTest, String... checkerOptions) Creates a new checker test. -
Method Summary
Modifier and TypeMethodDescriptionprotected static String
ajavaArgFromFiles
(List<File> sourceFiles, String checkerShortName) Computes the -Aajava argument that corresponds to the test files.protected static String
astubsArgFromFiles
(List<File> sourceFiles, String checkerShortName) Computes the -Astubs argument that corresponds to the test files.void
checkResult
(TypecheckResult typecheckResult) Check that theTypecheckResult
did not fail.protected File
Resolves the test root directory from the optionalTestRootDirectory
annotation or falls back to the default ofcurrentDir/tests
.void
run()
Run the tests.Methods inherited from class org.checkerframework.framework.test.CheckerFrameworkWPIPerDirectoryTest
doNotTypecheck, hasSkipComment
Methods inherited from class org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest
adjustTypecheckResult, customizeOptions
-
Constructor Details
-
AinferValidatePerDirectoryTest
protected AinferValidatePerDirectoryTest(List<File> testFiles, Class<? extends AbstractProcessor> checker, String checkerShortName, String testDir, Class<? extends AinferGeneratePerDirectoryTest> generationTest, String... checkerOptions) Creates a new checker test. Use this constructor when creating a validation test.TestConfigurationBuilder.getDefaultConfigurationBuilder(String, File, String, Iterable, Iterable, List, boolean)
adds additional checker options.- Parameters:
testFiles
- the files containing test code, which will be type-checkedchecker
- the class for the checker to usecheckerShortName
- the short name of the checker, as used in the naming conventions for files, e.g. "index" for the Index Checker or "testchecker" for the AInferTestCheckertestDir
- the path to the directory of test inputsgenerationTest
- the class of the test that must run before this test, if this is the second of a pair of testscheckerOptions
- options to pass to the compiler when running tests
-
-
Method Details
-
ajavaArgFromFiles
Computes the -Aajava argument that corresponds to the test files. This method is necessary because the framework issues a warning if a .ajava file with no corresponding source file is specified.Assumes that ajava files will be in the
#getInferenceBaseDir(String)
directory.- Parameters:
sourceFiles
- the list of source filescheckerShortName
- the short name of the checker, as used in the naming conventions for files, e.g. "index" for the Index Checker or "testchecker" for the AInferTestChecker- Returns:
- the appropriate -Aajava argument
-
astubsArgFromFiles
Computes the -Astubs argument that corresponds to the test files. This method is necessary because the framework issues a warning if a .astub file with no corresponding source file is specified.Assumes that astub files will be in the
#getInferenceBaseDir(String)
directory.- Parameters:
sourceFiles
- the list of source filescheckerShortName
- the short name of the checker, as used in the naming conventions for files, e.g. "index" for the Index Checker or "testchecker" for the AInferTestChecker- Returns:
- the appropriate -Astubs argument
-
run
public void run()Description copied from class:CheckerFrameworkPerDirectoryTest
Run the tests.- Overrides:
run
in classCheckerFrameworkPerDirectoryTest
-
resolveTestDirectory
Resolves the test root directory from the optionalTestRootDirectory
annotation or falls back to the default ofcurrentDir/tests
.- Returns:
- the resolved directory
-
checkResult
Check that theTypecheckResult
did not fail.- Parameters:
typecheckResult
- result to check
-