changeset 1305:5ac2e9ee969e

7192449: fix up tests to accommodate jtreg spec change Reviewed-by: darcy
author jjg
date Fri, 17 Aug 2012 17:30:03 -0700
parents 9d47f4850714
children 464f52f59f7d
files test/tools/javac/processing/6414633/T6414633.java test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java
diffstat 2 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javac/processing/6414633/T6414633.java	Wed Aug 15 13:48:46 2012 -0700
+++ b/test/tools/javac/processing/6414633/T6414633.java	Fri Aug 17 17:30:03 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2012, 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
@@ -43,20 +43,20 @@
     public static void main(String... args) {
         String testSrc = System.getProperty("test.src", ".");
         String testClasses = System.getProperty("test.classes", ".");
+        String testClassPath = System.getProperty("test.class.path", testClasses);
 
         JavacTool tool = JavacTool.create();
         MyDiagListener dl = new MyDiagListener();
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
         try {
-            fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(testClasses)));
+            fm.setLocation(StandardLocation.CLASS_PATH, pathToFiles(testClassPath));
         } catch (IOException e) {
             throw new AssertionError(e);
         }
         Iterable<? extends JavaFileObject> files =
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, A.class.getName()+".java")));
         String[] opts = { "-proc:only",
-                          "-processor", A.class.getName(),
-                          "-classpath", testClasses + System.getProperty("path.separator") + "../../lib" };
+                          "-processor", A.class.getName() };
         JavacTask task = tool.getTask(null, fm, dl, Arrays.asList(opts), null, files);
         task.call();
 
@@ -65,6 +65,15 @@
             throw new AssertionError(dl.diags + " diagnostics reported");
     }
 
+    private static List<File> pathToFiles(String path) {
+        List<File> list = new ArrayList<File>();
+        for (String s: path.split(File.pathSeparator)) {
+            if (!s.isEmpty())
+                list.add(new File(s));
+        }
+        return list;
+    }
+
     private static class MyDiagListener implements DiagnosticListener<JavaFileObject>
     {
         public void report(Diagnostic d) {
--- a/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java	Wed Aug 15 13:48:46 2012 -0700
+++ b/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java	Fri Aug 17 17:30:03 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, 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
@@ -38,7 +38,8 @@
 public class TestWithXstdout {
     public static void main(String... args) throws Exception {
         File testSrc = new File(System.getProperty("test.src"));
-        File testClasses = new File(System.getProperty("test.classes"));
+        String testClasses = System.getProperty("test.classes", ".");
+        String testClassPath = System.getProperty("test.class.path", testClasses);
         File stdout = new File("stdout.out");
         run_javac("-XDrawDiagnostics",
                 "-XprintProcessorInfo",
@@ -46,7 +47,7 @@
                 "-proc:only",
                 "-processor",  "Test",
                 "-Xstdout", stdout.getPath(),
-                "-classpath", testClasses.getPath(),
+                "-classpath", testClassPath,
                 new File(testSrc, "Test.java").getPath());
         boolean ok = compare(stdout, new File(testSrc, "Test.out"));
         if (!ok)