Fri, 17 Aug 2012 17:30:03 -0700
7192449: fix up tests to accommodate jtreg spec change
Reviewed-by: darcy
1.1 --- a/test/tools/javac/processing/6414633/T6414633.java Wed Aug 15 13:48:46 2012 -0700 1.2 +++ b/test/tools/javac/processing/6414633/T6414633.java Fri Aug 17 17:30:03 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -43,20 +43,20 @@ 1.11 public static void main(String... args) { 1.12 String testSrc = System.getProperty("test.src", "."); 1.13 String testClasses = System.getProperty("test.classes", "."); 1.14 + String testClassPath = System.getProperty("test.class.path", testClasses); 1.15 1.16 JavacTool tool = JavacTool.create(); 1.17 MyDiagListener dl = new MyDiagListener(); 1.18 StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null); 1.19 try { 1.20 - fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(testClasses))); 1.21 + fm.setLocation(StandardLocation.CLASS_PATH, pathToFiles(testClassPath)); 1.22 } catch (IOException e) { 1.23 throw new AssertionError(e); 1.24 } 1.25 Iterable<? extends JavaFileObject> files = 1.26 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, A.class.getName()+".java"))); 1.27 String[] opts = { "-proc:only", 1.28 - "-processor", A.class.getName(), 1.29 - "-classpath", testClasses + System.getProperty("path.separator") + "../../lib" }; 1.30 + "-processor", A.class.getName() }; 1.31 JavacTask task = tool.getTask(null, fm, dl, Arrays.asList(opts), null, files); 1.32 task.call(); 1.33 1.34 @@ -65,6 +65,15 @@ 1.35 throw new AssertionError(dl.diags + " diagnostics reported"); 1.36 } 1.37 1.38 + private static List<File> pathToFiles(String path) { 1.39 + List<File> list = new ArrayList<File>(); 1.40 + for (String s: path.split(File.pathSeparator)) { 1.41 + if (!s.isEmpty()) 1.42 + list.add(new File(s)); 1.43 + } 1.44 + return list; 1.45 + } 1.46 + 1.47 private static class MyDiagListener implements DiagnosticListener<JavaFileObject> 1.48 { 1.49 public void report(Diagnostic d) {
2.1 --- a/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java Wed Aug 15 13:48:46 2012 -0700 2.2 +++ b/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java Fri Aug 17 17:30:03 2012 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -38,7 +38,8 @@ 2.11 public class TestWithXstdout { 2.12 public static void main(String... args) throws Exception { 2.13 File testSrc = new File(System.getProperty("test.src")); 2.14 - File testClasses = new File(System.getProperty("test.classes")); 2.15 + String testClasses = System.getProperty("test.classes", "."); 2.16 + String testClassPath = System.getProperty("test.class.path", testClasses); 2.17 File stdout = new File("stdout.out"); 2.18 run_javac("-XDrawDiagnostics", 2.19 "-XprintProcessorInfo", 2.20 @@ -46,7 +47,7 @@ 2.21 "-proc:only", 2.22 "-processor", "Test", 2.23 "-Xstdout", stdout.getPath(), 2.24 - "-classpath", testClasses.getPath(), 2.25 + "-classpath", testClassPath, 2.26 new File(testSrc, "Test.java").getPath()); 2.27 boolean ok = compare(stdout, new File(testSrc, "Test.out")); 2.28 if (!ok)