changeset 47936:abe64cd683a4

8190906: tools/javac/failover/CheckAttributedTree.java failed with timeout Reviewed-by: jjg, mcimadamore
author vromero
date Mon, 20 Nov 2017 14:45:11 -0500
parents ebe854b910ff
children e29ae57c6421
files test/langtools/tools/javac/failover/CheckAttributedTree.java
diffstat 1 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/test/langtools/tools/javac/failover/CheckAttributedTree.java	Mon Nov 20 17:34:05 2017 +0530
+++ b/test/langtools/tools/javac/failover/CheckAttributedTree.java	Mon Nov 20 14:45:11 2017 -0500
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,8 +138,13 @@
             else
                 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.
      * In jtreg mode, the -r option can be given to change the default base
@@ -307,10 +312,12 @@
             Iterable<? extends JavaFileObject> files = fileManager().getJavaFileObjects(file);
             final List<Element> analyzedElems = new ArrayList<>();
             final List<CompilationUnitTree> trees = new ArrayList<>();
+            totalNumberOfCompilations++;
             newCompilationTask()
                 .withWriter(pw)
                     .withOption("--should-stop:at=ATTR")
                     .withOption("-XDverboseCompilePolicy")
+                    .withOption("-Xdoclint:none")
                     .withSource(files.iterator().next())
                     .withListener(new TaskListener() {
                         public void started(TaskEvent e) {
@@ -324,16 +331,18 @@
                     }
                 }).analyze(res -> {
                 Iterable<? extends Element> elems = res.get();
-                if (!elems.iterator().hasNext())
-                    throw new AssertionError("No results from analyze");
-                for (CompilationUnitTree t : trees) {
-                   JCCompilationUnit cu = (JCCompilationUnit)t;
-                   for (JCTree def : cu.defs) {
-                       if (def.hasTag(CLASSDEF) &&
-                               analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
-                           c.accept(cu, def);
+                if (elems.iterator().hasNext()) {
+                    for (CompilationUnitTree t : trees) {
+                       JCCompilationUnit cu = (JCCompilationUnit)t;
+                       for (JCTree def : cu.defs) {
+                           if (def.hasTag(CLASSDEF) &&
+                                   analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
+                               c.accept(cu, def);
+                           }
                        }
-                   }
+                    }
+                } else {
+                    numberOfFailedCompilations++;
                 }
             });
         }