changeset 2463:1fe358ea75ff

8024988: javac, LVT test harness should generate tests .class files in the scratch folder Summary: Set the CLASS_OUTPUT location to the scratch directory. Changed the argument to checkClassFile accordingly. Reviewed-by: jjg, vromero
author alundblad
date Mon, 23 Sep 2013 10:10:07 +0200
parents 20b72bae83d7
children 5f915a0c9615
files test/tools/javac/flow/LVTHarness.java
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javac/flow/LVTHarness.java	Sun Sep 22 20:20:38 2013 -0700
+++ b/test/tools/javac/flow/LVTHarness.java	Mon Sep 23 10:10:07 2013 +0200
@@ -64,6 +64,7 @@
 
 import static javax.tools.StandardLocation.*;
 import static com.sun.tools.classfile.LocalVariableTable_attribute.Entry;
+import static javax.tools.JavaFileObject.Kind.SOURCE;
 
 public class LVTHarness {
 
@@ -73,10 +74,14 @@
     static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
 
     public static void main(String[] args) throws Exception {
-        fm.setLocation(SOURCE_PATH,
-                Arrays.asList(new File(System.getProperty("test.src"), "tests")));
-        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "",
-                Collections.singleton(JavaFileObject.Kind.SOURCE), true)) {
+
+        String testDir = System.getProperty("test.src");
+        fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
+
+        // Make sure classes are written to scratch dir.
+        fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File(".")));
+
+        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) {
             new LVTHarness(jfo).check();
         }
         if (nerrors > 0) {
@@ -86,8 +91,7 @@
 
 
     JavaFileObject jfo;
-    Map<ElementKey, AliveRanges> aliveRangeMap =
-            new HashMap<ElementKey, AliveRanges>();
+    Map<ElementKey, AliveRanges> aliveRangeMap = new HashMap<>();
     Set<String> declaredKeys = new HashSet<>();
     List<ElementKey> seenAliveRanges = new ArrayList<>();
 
@@ -96,15 +100,19 @@
     }
 
     protected void check() throws Exception {
-        JavacTask ct = (JavacTask)comp.getTask(null, fm, null, Arrays.asList("-g"),
-                null, Arrays.asList(jfo));
-        System.err.println("compiling code " + jfo.toString());
+
+        JavacTask ct = (JavacTask) comp.getTask(null, fm, null, Arrays.asList("-g"),
+                                                null, Arrays.asList(jfo));
+        System.err.println("compiling code " + jfo);
         ct.setProcessors(Collections.singleton(new AliveRangeFinder()));
         if (!ct.call()) {
             throw new AssertionError("Error during compilation");
         }
 
-        checkClassFile(new File(jfo.getName().replace(".java", ".class")));
+
+        File javaFile = new File(jfo.getName());
+        File classFile = new File(javaFile.getName().replace(".java", ".class"));
+        checkClassFile(classFile);
 
         //check all candidates have been used up
         for (Map.Entry<ElementKey, AliveRanges> entry : aliveRangeMap.entrySet()) {