Disable lazy log checking by default

This commit is contained in:
Andrey Breslav
2014-11-21 18:10:28 +03:00
parent ae75c7ecd7
commit 4112b2de5f
2 changed files with 22 additions and 2 deletions
@@ -141,7 +141,19 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
// We want to always create a test data file (txt) if it was missing,
// but don't want to skip the following checks in case this one fails
Throwable exceptionFromLazyResolveLogValidation = checkLazyResolveLog(lazyOperationsLog, testDataFile);
Throwable exceptionFromLazyResolveLogValidation = null;
if (KotlinPackage.any(testFiles, new Function1<TestFile, Boolean>() {
@Override
public Boolean invoke(TestFile file) {
return file.checkLazyLog;
}
})) {
exceptionFromLazyResolveLogValidation = checkLazyResolveLog(lazyOperationsLog, testDataFile);
}
else {
File lazyLogFile = getLazyLogFile(testDataFile);
assertFalse("No lazy log expected, but found: " + lazyLogFile.getAbsolutePath(), lazyLogFile.exists());
}
Throwable exceptionFromDescriptorValidation = null;
try {
@@ -179,7 +191,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
private static Throwable checkLazyResolveLog(LazyOperationsLog lazyOperationsLog, File testDataFile) {
Throwable exceptionFromLazyResolveLogValidation = null;
try {
File expectedFile = new File(FileUtil.getNameWithoutExtension(testDataFile.getAbsolutePath()) + ".lazy.log");
File expectedFile = getLazyLogFile(testDataFile);
JetTestUtils.assertEqualsToFile(
expectedFile,
@@ -193,6 +205,10 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
return exceptionFromLazyResolveLogValidation;
}
private static File getLazyLogFile(File testDataFile) {
return new File(FileUtil.getNameWithoutExtension(testDataFile.getAbsolutePath()) + ".lazy.log");
}
private void validateAndCompareDescriptorWithFile(
File expectedFile,
List<TestFile> testFiles,
@@ -75,6 +75,8 @@ public abstract class BaseDiagnosticsTest extends
= "\npackage " + EXPLICIT_FLEXIBLE_PACKAGE +
"\npublic class " + EXPLICIT_FLEXIBLE_CLASS_NAME + "<L, U>";
private static final String EXPLICIT_FLEXIBLE_TYPES_IMPORT = "import " + EXPLICIT_FLEXIBLE_PACKAGE + "." + EXPLICIT_FLEXIBLE_CLASS_NAME;
public static final String CHECK_LAZY_LOG_DIRECTIVE = "CHECK_LAZY_LOG";
public static final boolean CHECK_LAZY_LOG_DEFAULT = "true".equals(System.getProperty("check.lazy.logs", "false"));
@Override
protected TestModule createTestModule(String name) {
@@ -237,6 +239,7 @@ public abstract class BaseDiagnosticsTest extends
private final Condition<Diagnostic> whatDiagnosticsToConsider;
private final boolean declareCheckType;
private final boolean declareFlexibleType;
public final boolean checkLazyLog;
public TestFile(
@Nullable TestModule module,
@@ -246,6 +249,7 @@ public abstract class BaseDiagnosticsTest extends
) {
this.module = module;
this.whatDiagnosticsToConsider = parseDiagnosticFilterDirective(directives);
this.checkLazyLog = directives.containsKey(CHECK_LAZY_LOG_DIRECTIVE) || CHECK_LAZY_LOG_DEFAULT;
this.declareCheckType = directives.containsKey(CHECK_TYPE_DIRECTIVE);
this.declareFlexibleType = directives.containsKey(EXPLICIT_FLEXIBLE_TYPES_DIRECTIVE);
if (fileName.endsWith(".java")) {