Disable lazy log checking by default
This commit is contained in:
@@ -141,7 +141,19 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
|||||||
|
|
||||||
// We want to always create a test data file (txt) if it was missing,
|
// 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
|
// 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;
|
Throwable exceptionFromDescriptorValidation = null;
|
||||||
try {
|
try {
|
||||||
@@ -179,7 +191,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
|||||||
private static Throwable checkLazyResolveLog(LazyOperationsLog lazyOperationsLog, File testDataFile) {
|
private static Throwable checkLazyResolveLog(LazyOperationsLog lazyOperationsLog, File testDataFile) {
|
||||||
Throwable exceptionFromLazyResolveLogValidation = null;
|
Throwable exceptionFromLazyResolveLogValidation = null;
|
||||||
try {
|
try {
|
||||||
File expectedFile = new File(FileUtil.getNameWithoutExtension(testDataFile.getAbsolutePath()) + ".lazy.log");
|
File expectedFile = getLazyLogFile(testDataFile);
|
||||||
|
|
||||||
JetTestUtils.assertEqualsToFile(
|
JetTestUtils.assertEqualsToFile(
|
||||||
expectedFile,
|
expectedFile,
|
||||||
@@ -193,6 +205,10 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest {
|
|||||||
return exceptionFromLazyResolveLogValidation;
|
return exceptionFromLazyResolveLogValidation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File getLazyLogFile(File testDataFile) {
|
||||||
|
return new File(FileUtil.getNameWithoutExtension(testDataFile.getAbsolutePath()) + ".lazy.log");
|
||||||
|
}
|
||||||
|
|
||||||
private void validateAndCompareDescriptorWithFile(
|
private void validateAndCompareDescriptorWithFile(
|
||||||
File expectedFile,
|
File expectedFile,
|
||||||
List<TestFile> testFiles,
|
List<TestFile> testFiles,
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ public abstract class BaseDiagnosticsTest extends
|
|||||||
= "\npackage " + EXPLICIT_FLEXIBLE_PACKAGE +
|
= "\npackage " + EXPLICIT_FLEXIBLE_PACKAGE +
|
||||||
"\npublic class " + EXPLICIT_FLEXIBLE_CLASS_NAME + "<L, U>";
|
"\npublic class " + EXPLICIT_FLEXIBLE_CLASS_NAME + "<L, U>";
|
||||||
private static final String EXPLICIT_FLEXIBLE_TYPES_IMPORT = "import " + EXPLICIT_FLEXIBLE_PACKAGE + "." + 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
|
@Override
|
||||||
protected TestModule createTestModule(String name) {
|
protected TestModule createTestModule(String name) {
|
||||||
@@ -237,6 +239,7 @@ public abstract class BaseDiagnosticsTest extends
|
|||||||
private final Condition<Diagnostic> whatDiagnosticsToConsider;
|
private final Condition<Diagnostic> whatDiagnosticsToConsider;
|
||||||
private final boolean declareCheckType;
|
private final boolean declareCheckType;
|
||||||
private final boolean declareFlexibleType;
|
private final boolean declareFlexibleType;
|
||||||
|
public final boolean checkLazyLog;
|
||||||
|
|
||||||
public TestFile(
|
public TestFile(
|
||||||
@Nullable TestModule module,
|
@Nullable TestModule module,
|
||||||
@@ -246,6 +249,7 @@ public abstract class BaseDiagnosticsTest extends
|
|||||||
) {
|
) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.whatDiagnosticsToConsider = parseDiagnosticFilterDirective(directives);
|
this.whatDiagnosticsToConsider = parseDiagnosticFilterDirective(directives);
|
||||||
|
this.checkLazyLog = directives.containsKey(CHECK_LAZY_LOG_DIRECTIVE) || CHECK_LAZY_LOG_DEFAULT;
|
||||||
this.declareCheckType = directives.containsKey(CHECK_TYPE_DIRECTIVE);
|
this.declareCheckType = directives.containsKey(CHECK_TYPE_DIRECTIVE);
|
||||||
this.declareFlexibleType = directives.containsKey(EXPLICIT_FLEXIBLE_TYPES_DIRECTIVE);
|
this.declareFlexibleType = directives.containsKey(EXPLICIT_FLEXIBLE_TYPES_DIRECTIVE);
|
||||||
if (fileName.endsWith(".java")) {
|
if (fileName.endsWith(".java")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user