mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8050429: Update/cleanup ToolBox
Reviewed-by: vromero
This commit is contained in:
parent
14fcc1d07d
commit
33e6564a6b
54 changed files with 2577 additions and 1792 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2014, 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
|
||||
|
@ -25,15 +25,15 @@
|
|||
* @test
|
||||
* @bug 6271292
|
||||
* @summary Verify that javap prints StackMapTable attribute contents
|
||||
* @library /tools/javac/lib
|
||||
* @library /tools/lib
|
||||
* @build ToolBox
|
||||
* @run main StackmapTest
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//original test: test/tools/javap/stackmap/T6271292.sh
|
||||
// Original test: test/tools/javap/stackmap/T6271292.sh
|
||||
public class StackmapTest {
|
||||
|
||||
private static final String TestSrc =
|
||||
|
@ -58,41 +58,42 @@ public class StackmapTest {
|
|||
"}\n";
|
||||
|
||||
private static final String goldenOut =
|
||||
"frame_type = 255 /* full_frame */\n" +
|
||||
"frame_type = 255 /* full_frame */\n" +
|
||||
"frame_type = 73 /* same_locals_1_stack_item */\n" +
|
||||
"frame_type = 255 /* full_frame */\n" +
|
||||
"offset_delta = 19\n" +
|
||||
"offset_delta = 0\n" +
|
||||
"offset_delta = 2\n" +
|
||||
"stack = [ uninitialized 0, uninitialized 0 ]\n" +
|
||||
"stack = [ uninitialized 0, uninitialized 0, double ]\n" +
|
||||
"stack = [ this ]\n" +
|
||||
"stack = [ this, double ]\n" +
|
||||
"locals = [ class \"[Ljava/lang/String;\" ]\n" +
|
||||
"locals = [ class \"[Ljava/lang/String;\" ]\n" +
|
||||
"locals = [ this, int ]\n";
|
||||
" frame_type = 255 /* full_frame */\n" +
|
||||
" frame_type = 255 /* full_frame */\n" +
|
||||
" frame_type = 73 /* same_locals_1_stack_item */\n" +
|
||||
" frame_type = 255 /* full_frame */\n" +
|
||||
" offset_delta = 19\n" +
|
||||
" offset_delta = 0\n" +
|
||||
" offset_delta = 2\n" +
|
||||
" stack = [ uninitialized 0, uninitialized 0 ]\n" +
|
||||
" stack = [ uninitialized 0, uninitialized 0, double ]\n" +
|
||||
" stack = [ this ]\n" +
|
||||
" stack = [ this, double ]\n" +
|
||||
" locals = [ class \"[Ljava/lang/String;\" ]\n" +
|
||||
" locals = [ class \"[Ljava/lang/String;\" ]\n" +
|
||||
" locals = [ this, int ]\n";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// @compile T6271292.java
|
||||
ToolBox.JavaToolArgs javacParams =
|
||||
new ToolBox.JavaToolArgs().setSources(TestSrc);
|
||||
ToolBox.javac(javacParams);
|
||||
ToolBox tb = new ToolBox();
|
||||
|
||||
// "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" -verbose T6271292 > "${JAVAPFILE}"
|
||||
ToolBox.JavaToolArgs javapParams =
|
||||
new ToolBox.JavaToolArgs()
|
||||
.setAllArgs("-v", "Test.class");
|
||||
String out = ToolBox.javap(javapParams);
|
||||
List<String> grepResult = ToolBox.grep("frame_type", out,
|
||||
ToolBox.lineSeparator);
|
||||
grepResult.addAll(ToolBox.grep("offset_delta", out, ToolBox.lineSeparator));
|
||||
grepResult.addAll(ToolBox.grep("stack = ", out, ToolBox.lineSeparator));
|
||||
grepResult.addAll(ToolBox.grep("locals = ", out, ToolBox.lineSeparator));
|
||||
List<String> goldenList = Arrays.asList(goldenOut.split("\n"));
|
||||
tb.new JavacTask()
|
||||
.sources(TestSrc)
|
||||
.run();
|
||||
|
||||
// diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"
|
||||
ToolBox.compareLines(goldenList, grepResult, true);
|
||||
List<String> out = tb.new JavapTask()
|
||||
.options("-v")
|
||||
.classes("Test.class")
|
||||
.run()
|
||||
.getOutputLines(ToolBox.OutputKind.DIRECT);
|
||||
|
||||
List<String> grepResult = new ArrayList<>();
|
||||
grepResult.addAll(tb.grep("frame_type", out));
|
||||
grepResult.addAll(tb.grep("offset_delta", out));
|
||||
grepResult.addAll(tb.grep("stack = ", out));
|
||||
grepResult.addAll(tb.grep("locals = ", out));
|
||||
|
||||
List<String> goldenList = tb.split(goldenOut, "\n");
|
||||
tb.checkEqual(goldenList, grepResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue