mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8024988: javac, LVT test harness should generate tests .class files in the scratch folder
Set the CLASS_OUTPUT location to the scratch directory. Changed the argument to checkClassFile accordingly. Reviewed-by: jjg, vromero
This commit is contained in:
parent
186556ad21
commit
a2a38c6b65
1 changed files with 18 additions and 10 deletions
|
@ -64,6 +64,7 @@ import com.sun.tools.classfile.Method;
|
|||
|
||||
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 @@ public class LVTHarness {
|
|||
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 @@ public class LVTHarness {
|
|||
|
||||
|
||||
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 @@ public class LVTHarness {
|
|||
}
|
||||
|
||||
protected void check() throws Exception {
|
||||
JavacTask ct = (JavacTask)comp.getTask(null, fm, null, Arrays.asList("-g"),
|
||||
|
||||
JavacTask ct = (JavacTask) comp.getTask(null, fm, null, Arrays.asList("-g"),
|
||||
null, Arrays.asList(jfo));
|
||||
System.err.println("compiling code " + jfo.toString());
|
||||
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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue