8190906: tools/javac/failover/CheckAttributedTree.java failed with timeout

Reviewed-by: jjg, mcimadamore
This commit is contained in:
Vicente Romero 2017-11-20 14:45:11 -05:00
parent de661c5bd2
commit cffac90ef9

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -138,8 +138,13 @@ public class CheckAttributedTree {
else else
System.exit(1); System.exit(1);
} }
System.err.println("total number of compilations " + totalNumberOfCompilations);
System.err.println("number of failed compilations " + numberOfFailedCompilations);
} }
static private int totalNumberOfCompilations = 0;
static private int numberOfFailedCompilations = 0;
/** /**
* Run the program. A base directory can be provided for file arguments. * Run the program. A base directory can be provided for file arguments.
* In jtreg mode, the -r option can be given to change the default base * In jtreg mode, the -r option can be given to change the default base
@ -307,10 +312,12 @@ public class CheckAttributedTree {
Iterable<? extends JavaFileObject> files = fileManager().getJavaFileObjects(file); Iterable<? extends JavaFileObject> files = fileManager().getJavaFileObjects(file);
final List<Element> analyzedElems = new ArrayList<>(); final List<Element> analyzedElems = new ArrayList<>();
final List<CompilationUnitTree> trees = new ArrayList<>(); final List<CompilationUnitTree> trees = new ArrayList<>();
totalNumberOfCompilations++;
newCompilationTask() newCompilationTask()
.withWriter(pw) .withWriter(pw)
.withOption("--should-stop:at=ATTR") .withOption("--should-stop:at=ATTR")
.withOption("-XDverboseCompilePolicy") .withOption("-XDverboseCompilePolicy")
.withOption("-Xdoclint:none")
.withSource(files.iterator().next()) .withSource(files.iterator().next())
.withListener(new TaskListener() { .withListener(new TaskListener() {
public void started(TaskEvent e) { public void started(TaskEvent e) {
@ -324,8 +331,7 @@ public class CheckAttributedTree {
} }
}).analyze(res -> { }).analyze(res -> {
Iterable<? extends Element> elems = res.get(); Iterable<? extends Element> elems = res.get();
if (!elems.iterator().hasNext()) if (elems.iterator().hasNext()) {
throw new AssertionError("No results from analyze");
for (CompilationUnitTree t : trees) { for (CompilationUnitTree t : trees) {
JCCompilationUnit cu = (JCCompilationUnit)t; JCCompilationUnit cu = (JCCompilationUnit)t;
for (JCTree def : cu.defs) { for (JCTree def : cu.defs) {
@ -335,6 +341,9 @@ public class CheckAttributedTree {
} }
} }
} }
} else {
numberOfFailedCompilations++;
}
}); });
} }