Class AinferValidatePerDirectoryTest
- java.lang.Object
-
- org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest
-
- org.checkerframework.framework.test.CheckerFrameworkWPIPerDirectoryTest
-
- org.checkerframework.framework.test.AinferValidatePerDirectoryTest
-
public class AinferValidatePerDirectoryTest extends CheckerFrameworkWPIPerDirectoryTest
A specialized variant ofCheckerFrameworkPerDirectoryTest
for testing the Whole Program Inference feature of the Checker Framework, which is tested by running pairs of these tests: a "generation test" (of classAinferGeneratePerDirectoryTest
) 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
Constructors Modifier Constructor Description protected
AinferValidatePerDirectoryTest(java.util.List<java.io.File> testFiles, java.lang.Class<? extends javax.annotation.processing.AbstractProcessor> checker, java.lang.String checkerShortName, java.lang.String testDir, java.lang.Class<? extends AinferGeneratePerDirectoryTest> generationTest, java.lang.String... checkerOptions)
Creates a new checker test.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.String
ajavaArgFromFiles(java.util.List<java.io.File> sourceFiles, java.lang.String checkerShortName)
Computes the -Aajava argument that corresponds to the test files.protected static java.lang.String
astubsArgFromFiles(java.util.List<java.io.File> sourceFiles, java.lang.String checkerShortName)
Computes the -Astubs argument that corresponds to the test files.void
checkResult(TypecheckResult typecheckResult)
Check that theTypecheckResult
did not fail.protected java.io.File
resolveTestDirectory()
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 Detail
-
AinferValidatePerDirectoryTest
protected AinferValidatePerDirectoryTest(java.util.List<java.io.File> testFiles, java.lang.Class<? extends javax.annotation.processing.AbstractProcessor> checker, java.lang.String checkerShortName, java.lang.String testDir, java.lang.Class<? extends AinferGeneratePerDirectoryTest> generationTest, java.lang.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 Detail
-
ajavaArgFromFiles
protected static java.lang.String ajavaArgFromFiles(java.util.List<java.io.File> sourceFiles, java.lang.String checkerShortName)
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
protected static java.lang.String astubsArgFromFiles(java.util.List<java.io.File> sourceFiles, java.lang.String checkerShortName)
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
protected java.io.File resolveTestDirectory()
Resolves the test root directory from the optionalTestRootDirectory
annotation or falls back to the default ofcurrentDir/tests
.- Returns:
- the resolved directory
-
checkResult
public void checkResult(TypecheckResult typecheckResult)
Check that theTypecheckResult
did not fail.- Parameters:
typecheckResult
- result to check
-
-