diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java index 5512dd97320..6dc39263ac1 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java @@ -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() { + @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 testFiles, diff --git a/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java index c35f976ce73..97cc4fe60c2 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/BaseDiagnosticsTest.java @@ -75,6 +75,8 @@ public abstract class BaseDiagnosticsTest extends = "\npackage " + EXPLICIT_FLEXIBLE_PACKAGE + "\npublic class " + EXPLICIT_FLEXIBLE_CLASS_NAME + ""; 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 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")) {