8008582: jtreg failures after conversion of shell tests to Java

Reviewed-by: jjg
This commit is contained in:
Vicente Romero 2013-03-14 08:30:16 +00:00
parent 52954e063d
commit 4ef6ef5d0f
10 changed files with 199 additions and 113 deletions

View File

@ -85,17 +85,4 @@ public class ArrayUtils {
}
}
public static <T> T[] concat(T[] anArr, T[] anotherArr) {
int newLength = anArr.length + anotherArr.length;
@SuppressWarnings("unchecked")
T[] result = (T[]) Array.newInstance(anArr.getClass().getComponentType(), newLength);
System.arraycopy(anArr, 0, result, 0, anArr.length);
System.arraycopy(anotherArr, 0, result, anArr.length, anotherArr.length);
return result;
}
@SuppressWarnings("unchecked")
public static <T> T[] concatOpen(T[] anArr, T... anotherArr) {
return concat(anArr, anotherArr);
}
}

View File

@ -34,9 +34,7 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import com.sun.tools.javac.util.ArrayUtils;
//original test: test/tools/javac/4846262/Test.sh
public class CheckEBCDICLocaleTest {
private static final String TestSrc =
@ -46,11 +44,11 @@ public class CheckEBCDICLocaleTest {
" }\n" +
"}";
private static final String TestOut =
"output/Test.java:3: error: not a statement\n" +
private static final String TestOutTemplate =
"output%1$sTest.java:3: error: not a statement\n" +
" abcdefg\n" +
" ^\n" +
"output/Test.java:3: error: ';' expected\n" +
"output%1$sTest.java:3: error: ';' expected\n" +
" abcdefg\n" +
" ^\n" +
"2 errors\n";
@ -62,38 +60,37 @@ public class CheckEBCDICLocaleTest {
public void test() throws Exception {
String native2asciiBinary = Paths.get(
System.getProperty("test.jdk"),"bin", "native2ascii").toString();
String testVMOpts = System.getProperty("test.tool.vm.opts");
String[] mainArgs = ToolBox.getJavacBin();
ToolBox.createJavaFileFromSource(TestSrc);
Files.createDirectory(Paths.get("output"));
//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -reverse -encoding IBM1047 ${TESTSRC}${FS}Test.java Test.java
ToolBox.AnyToolArgs nativeCmdParams =
new ToolBox.AnyToolArgs()
.setAllArgs(native2asciiBinary, testVMOpts,
"-reverse", "-encoding", "IBM1047",
"Test.java", "output/Test.java");
.appendArgs(native2asciiBinary)
.appendArgs(ToolBox.testToolVMOpts)
.appendArgs("-reverse", "-encoding", "IBM1047", "Test.java",
"output/Test.java");
ToolBox.executeCommand(nativeCmdParams);
//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Duser.language=en -J-Duser.region=US -J-Dfile.encoding=IBM1047 Test.java 2>Test.tmp
ToolBox.AnyToolArgs javacParams =
new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Duser.language=en",
.appendArgs(ToolBox.javacBinary)
.appendArgs(ToolBox.testToolVMOpts)
.appendArgs("-J-Duser.language=en",
"-J-Duser.region=US", "-J-Dfile.encoding=IBM1047",
"output/Test.java"))
"output/Test.java")
.setErrOutput(new File("Test.tmp"));
ToolBox.executeCommand(javacParams);
//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -encoding IBM1047 Test.tmp Test.out
nativeCmdParams.setAllArgs(native2asciiBinary, "-encoding", "IBM1047",
"Test.tmp", "Test.out");
nativeCmdParams = new ToolBox.AnyToolArgs()
.appendArgs(native2asciiBinary)
.appendArgs(ToolBox.testToolVMOpts)
.appendArgs("-encoding", "IBM1047", "Test.tmp", "Test.out");
ToolBox.executeCommand(nativeCmdParams);
//diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
String goldenFile = String.format(TestOutTemplate, File.separator);
ToolBox.compareLines(Paths.get("Test.out"),
Arrays.asList(TestOut.split("\n")), null);
Arrays.asList(goldenFile.split("\n")), null, true);
}
}

View File

@ -31,9 +31,11 @@
*/
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.sun.tools.javac.util.ArrayUtils;
//original test: test/tools/javac/ClassPathTest/ClassPathTest.sh
public class ClassPathTest {
@ -92,24 +94,31 @@ public class ClassPathTest {
}
void checkCompileCommands() throws Exception {
String[] mainArgs = ToolBox.getJavacBin();
// Without the -cp . parameter the command will fail seems like when called
// from the command line, the current dir is added to the classpath
// automatically but this is not happening when called using ProcessBuilder
// testJavac success ClassPathTest3.java
String[] commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", ".");
List<String> mainArgs = new ArrayList<>();
mainArgs.add(ToolBox.javacBinary.toString());
if (ToolBox.testToolVMOpts != null) {
mainArgs.addAll(ToolBox.testToolVMOpts);
}
ToolBox.AnyToolArgs successParams =
new ToolBox.AnyToolArgs()
.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
List<String> commonArgs = new ArrayList<>();
commonArgs.addAll(mainArgs);
commonArgs.addAll(Arrays.asList("-cp", "."));
ToolBox.AnyToolArgs successParams = new ToolBox.AnyToolArgs()
.appendArgs(commonArgs)
.appendArgs("ClassPathTest3.java");
ToolBox.executeCommand(successParams);
// testJavac failure ClassPathTest1.java
ToolBox.AnyToolArgs failParams =
new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
.appendArgs(commonArgs)
.appendArgs("ClassPathTest1.java");
ToolBox.executeCommand(failParams);
// This is done inside the executeCommand method
@ -119,29 +128,50 @@ public class ClassPathTest {
extVars.put("CLASSPATH", "bar");
// testJavac success ClassPathTest2.java
successParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest2.java")).set(extVars);
successParams = new ToolBox.AnyToolArgs()
.appendArgs(mainArgs)
.appendArgs("ClassPathTest2.java")
.set(extVars);
ToolBox.executeCommand(successParams);
// testJavac failure ClassPathTest1.java
failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest1.java")).set(extVars);
failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.appendArgs(mainArgs)
.appendArgs("ClassPathTest1.java")
.set(extVars);
ToolBox.executeCommand(failParams);
// testJavac failure ClassPathTest3.java
failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest3.java"));
failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.appendArgs(mainArgs)
.appendArgs("ClassPathTest3.java")
.set(extVars);
ToolBox.executeCommand(failParams);
// testJavac success -classpath foo ClassPathTest1.java
commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", "foo");
successParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
commonArgs.clear();
commonArgs.addAll(mainArgs);
commonArgs.addAll(Arrays.asList("-cp", "foo"));
successParams = new ToolBox.AnyToolArgs()
.appendArgs(commonArgs)
.appendArgs("ClassPathTest1.java")
.set(extVars);
ToolBox.executeCommand(successParams);
// testJavac failure -classpath foo ClassPathTest2.java
failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest2.java"));
failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.appendArgs(commonArgs)
.appendArgs("ClassPathTest2.java")
.set(extVars);
ToolBox.executeCommand(failParams);
// testJavac failure -classpath foo ClassPathTest3.java
failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.appendArgs(commonArgs)
.appendArgs("ClassPathTest3.java")
.set(extVars);
ToolBox.executeCommand(failParams);
}

View File

@ -91,7 +91,9 @@ public class ProtectedInnerClassesTest {
//"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
ToolBox.AnyToolArgs javaParams =
new ToolBox.AnyToolArgs()
.setAllArgs(ToolBox.javaBinary, "-classpath", System.getProperty("user.dir"),
.appendArgs(ToolBox.javaBinary)
.appendArgs(ToolBox.testVMOpts)
.appendArgs("-classpath", System.getProperty("user.dir"),
"p2.ProtectedInnerClass2");
ToolBox.executeCommand(javaParams);
}
@ -101,14 +103,15 @@ public class ProtectedInnerClassesTest {
//@run compile p1/ProtectedInnerClass1.java
ToolBox.JavaToolArgs javacParams =
new ToolBox.JavaToolArgs()
.setOptions("-d", ".")
.appendArgs("-d", ".")
.setSources(protectedInnerClass1Src);
ToolBox.javac(javacParams);
//@run compile/fail p2/ProtectedInnerClass3.java
javacParams.setSources(protectedInnerClass3Src)
.set(ToolBox.Expect.FAIL);
javacParams = new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
.appendArgs("-d", ".")
.setSources(protectedInnerClass3Src);
ToolBox.javac(javacParams);
}

View File

@ -38,6 +38,7 @@ import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
@ -65,15 +66,32 @@ public class ToolBox {
public static final String lineSeparator = System.getProperty("line.separator");
public static final String jdkUnderTest = System.getProperty("test.jdk");
public static final String testVMOpts = System.getProperty("test.tool.vm.opts");
public static final String javaBinary = Paths.get(jdkUnderTest, "bin", "java").toString();
//why this one private. Because the function which provide also the test options should be used
private static final String javacBinary = Paths.get(jdkUnderTest, "bin", "javac").toString();
public static final Path javaBinary = Paths.get(jdkUnderTest, "bin", "java");
public static final Path javacBinary = Paths.get(jdkUnderTest, "bin", "javac");
public static final List<String> testToolVMOpts;
public static final List<String> testVMOpts;
private static final Charset defaultCharset = Charset.defaultCharset();
static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
static {
String sysProp = System.getProperty("test.tool.vm.opts");
if (sysProp != null && sysProp.length() > 0) {
testToolVMOpts = Arrays.asList(sysProp.split("\\s+"));
} else {
testToolVMOpts = Collections.<String>emptyList();
}
sysProp = System.getProperty("test.vm.opts");
if (sysProp != null && sysProp.length() > 0) {
testVMOpts = Arrays.asList(sysProp.split("\\s+"));
} else {
testVMOpts = Collections.<String>emptyList();
}
}
/**
* The expected result of command-like method execution.
*/
@ -199,8 +217,8 @@ public class ToolBox {
protected Expect whatToExpect;
protected WriterHelper stdOutput;
protected WriterHelper errOutput;
protected List<String> options;
protected String[] optionsArr;
protected List<String> args = new ArrayList<>();
protected String[] argsArr;
protected GenericArgs() {
set(Expect.SUCCESS);
@ -238,19 +256,50 @@ public class ToolBox {
public T setAllArgs(String... args) {
currentParams.add(AcceptedParams.OPTIONS);
this.optionsArr = args;
this.argsArr = args;
return (T) this;
}
public T appendArgs(String... args) {
appendArgs(Arrays.asList(args));
return (T)this;
}
public T appendArgs(Path... args) {
if (args != null) {
List<String> list = new ArrayList<>();
for (int i = 0; i < args.length; i++) {
if (args[i] != null) {
list.add(args[i].toString());
}
}
appendArgs(list);
}
return (T)this;
}
public T appendArgs(List<String> args) {
if (args != null && args.size() > 0) {
currentParams.add(AcceptedParams.OPTIONS);
for (int i = 0; i < args.size(); i++) {
if (args.get(i) != null) {
this.args.add(args.get(i));
}
}
}
return (T)this;
}
public T setOptions(List<String> options) {
currentParams.add(AcceptedParams.OPTIONS);
this.options = options;
this.args = options;
return (T)this;
}
public T setOptions(String... options) {
currentParams.add(AcceptedParams.OPTIONS);
this.options = Arrays.asList(options);
this.args = Arrays.asList(options);
return (T)this;
}
@ -365,8 +414,12 @@ public class ToolBox {
* Custom exception for not equal resources.
*/
public static class ResourcesNotEqualException extends Exception {
public ResourcesNotEqualException() {
super("The resources provided for comparison are different");
public ResourcesNotEqualException(List<String> res1, List<String> res2) {
super(createMessage(res1, res2));
}
public ResourcesNotEqualException(String line1, String line2) {
super(createMessage(line1, line2));
}
public ResourcesNotEqualException(Path path1, Path path2) {
@ -379,15 +432,20 @@ public class ToolBox {
.append(path1.toString()).append(" and \n")
.append(path2.toString()).append("are different").toString();
}
}
/**
* Method to get the a path to the javac command available at the jdk being
* tested along with the test vm options.
* @return a String[] with the two components mentioned.
*/
public static String[] getJavacBin() {
return new String[]{javacBinary, testVMOpts};
private static String createMessage(String line1, String line2) {
return new StringBuilder()
.append("The resources provided for comparison are different at lines: \n")
.append(line1).append(" and \n")
.append(line2).toString();
}
private static String createMessage(List<String> res1, List<String> res2) {
return new StringBuilder()
.append("The resources provided for comparison are different: \n")
.append("Resource 1 is: ").append(res1).append("\n and \n")
.append("Resource 2 is: ").append(res2).append("\n").toString();
}
}
/**
@ -396,7 +454,7 @@ public class ToolBox {
public static int javac(JavaToolArgs params)
throws CommandExecutionException, IOException {
if (params.hasMinParams()) {
if (params.optionsArr != null) {
if (params.argsArr != null) {
return genericJavaCMD(JavaCMD.JAVAC, params);
} else {
return genericJavaCMD(JavaCMD.JAVAC_API, params);
@ -437,14 +495,14 @@ public class ToolBox {
JAVAC {
@Override
int run(JavaToolArgs params, PrintWriter pw) {
return com.sun.tools.javac.Main.compile(params.optionsArr, pw);
return com.sun.tools.javac.Main.compile(params.argsArr, pw);
}
},
JAVAC_API {
@Override
int run(JavaToolArgs params, PrintWriter pw) {
JavacTask ct = (JavacTask)comp.getTask(pw, null, null,
params.options, null, params.sources);
params.args, null, params.sources);
return ((JavacTaskImpl)ct).doCall().exitCode;
}
@ -467,13 +525,13 @@ public class ToolBox {
JAVAH {
@Override
int run(JavaToolArgs params, PrintWriter pw) {
return com.sun.tools.javah.Main.run(params.optionsArr, pw);
return com.sun.tools.javah.Main.run(params.argsArr, pw);
}
},
JAVAP {
@Override
int run(JavaToolArgs params, PrintWriter pw) {
return com.sun.tools.javap.Main.run(params.optionsArr, pw);
return com.sun.tools.javap.Main.run(params.argsArr, pw);
}
};
@ -486,9 +544,9 @@ public class ToolBox {
List<String> getExceptionMsgContent(JavaToolArgs params) {
List<String> result = new ArrayList<>();
result.add(getName());
result.addAll(params.optionsArr != null ?
Arrays.asList(params.optionsArr) :
params.options);
result.addAll(params.argsArr != null ?
Arrays.asList(params.argsArr) :
params.args);
return result;
}
}
@ -509,7 +567,7 @@ public class ToolBox {
String out = (sw == null) ? null : sw.toString();
if (params.errOutput != null && (out != null) && !out.isEmpty()) {
params.errOutput.addAll(splitLines(out));
params.errOutput.addAll(splitLines(out, lineSeparator));
}
if ( (rc == 0 && params.whatToExpect == Expect.SUCCESS) ||
@ -542,9 +600,9 @@ public class ToolBox {
public static int executeCommand(AnyToolArgs params)
throws CommandExecutionException, IOException, InterruptedException {
if (params.hasMinParams()) {
List<String> cmd = (params.options != null) ?
params.options :
Arrays.asList(params.optionsArr);
List<String> cmd = (params.args != null) ?
params.args :
Arrays.asList(params.argsArr);
return executeCommand(cmd, params.extraEnv, params.stdOutput,
params.errOutput, params.whatToExpect);
}
@ -630,7 +688,7 @@ public class ToolBox {
List<String> list2, boolean trim) throws ResourcesNotEqualException {
if ((list1 == list2) || (list1 == null && list2 == null)) return;
if (list1.size() != list2.size())
throw new ResourcesNotEqualException();
throw new ResourcesNotEqualException(list1, list2);
int i = 0;
int j = 0;
while (i < list1.size() &&
@ -639,7 +697,7 @@ public class ToolBox {
i++; j++;
}
if (!(i == list1.size() && j == list2.size()))
throw new ResourcesNotEqualException();
throw new ResourcesNotEqualException(list1, list2);
}
private static boolean equals(String s1, String s2, boolean trim) {
@ -652,8 +710,8 @@ public class ToolBox {
* and later the regExpr is seek in every split line. If a match is found,
* the whole line is added to the result.
*/
public static List<String> grep(String regExpr, String text) {
return grep(regExpr, splitLines(text));
public static List<String> grep(String regExpr, String text, String sep) {
return grep(regExpr, splitLines(text, sep));
}
public static List<String> grep(String regExpr, List<String> text) {
@ -865,8 +923,8 @@ public class ToolBox {
/**
* Splits a String using the System's line separator character as splitting point.
*/
public static List<String> splitLines(String lines) {
return Arrays.asList(lines.split(lineSeparator));
public static List<String> splitLines(String lines, String sep) {
return Arrays.asList(lines.split(sep));
}
/**
@ -881,6 +939,14 @@ public class ToolBox {
return sb.toString();
}
/**
* Returns true if the OS is a Windows version.
*/
public static boolean isWindows() {
String osName = System.getProperty("os.name");
return osName.toUpperCase().startsWith("WINDOWS");
}
/**
* Class representing an in-memory java source file. It is able to extract
* the file name from simple source codes using regular expressions.

View File

@ -50,14 +50,17 @@ public class LinksTest {
// cp ${TESTSRC}/b/B.java tmp
ToolBox.writeFile(Paths.get("tmp", "B.java"), BSrc);
try {
// ln -s `pwd`/tmp "${TESTCLASSES}/a"
Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
//
////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
ToolBox.JavaToolArgs javacArgs =
new ToolBox.JavaToolArgs()
.setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
ToolBox.javac(javacArgs);
Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
ToolBox.JavaToolArgs javacArgs =
new ToolBox.JavaToolArgs()
.setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
ToolBox.javac(javacArgs);
} catch (UnsupportedOperationException e) {
System.err.println("Symbolic links not supported on this system. The test can't finish");
}
}
}

View File

@ -34,19 +34,18 @@ import java.io.File;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.List;
import com.sun.tools.javac.util.ArrayUtils;
//original test: test/tools/javac/newlines/Newlines.sh
public class NewLineTest {
public static void main(String args[]) throws Exception {
String[] mainArgs = ToolBox.getJavacBin();
// "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
File javacErrOutput = new File("output.txt");
ToolBox.AnyToolArgs cmdArgs =
new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
.setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Dline.separator='@'"))
.appendArgs(ToolBox.javacBinary)
.appendArgs(ToolBox.testToolVMOpts)
.appendArgs("-J-Dline.separator='@'")
.setErrOutput(javacErrOutput);
ToolBox.executeCommand(cmdArgs);

View File

@ -32,7 +32,6 @@
import java.nio.file.Paths;
//original test: test/tools/javah/6257087/foo.sh
public class T6257087 {
private static final String fooBarGoldenFile =
@ -59,17 +58,13 @@ public class T6257087 {
"#endif";
public static void main(String[] args) throws Exception {
// "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TS}${FS}foo.java"
// "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -classpath "${TC}" -d "${TC}" foo
ToolBox.JavaToolArgs javahArgs =
new ToolBox.JavaToolArgs()
.setAllArgs("-cp", System.getProperty("test.classes"), "foo");
ToolBox.javah(javahArgs);
// diff ${DIFFOPTS} -c "${TS}${FS}foo_bar.h" "${TC}${FS}foo_bar.h"
ToolBox.compareLines(Paths.get("foo_bar.h"),
ToolBox.splitLines(fooBarGoldenFile), null);
ToolBox.splitLines(fooBarGoldenFile, "\n"), null, true);
}
}

View File

@ -38,7 +38,7 @@ import java.nio.file.Paths;
//original test: test/tools/javah/ConstMacroTest.sh
public class ConstMacroTest {
private static final String SubClassConstsGoldenFile =
private static final String subClassConstsGoldenFileTemplate =
"/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
"#include <jni.h>\n" +
"/* Header for class SubClassConsts */\n" +
@ -49,7 +49,7 @@ public class ConstMacroTest {
"extern \"C\" {\n" +
"#endif\n" +
"#undef SubClassConsts_serialVersionUID\n" +
"#define SubClassConsts_serialVersionUID 6733861379283244755LL\n" +
"#define SubClassConsts_serialVersionUID 6733861379283244755%s\n" +
"#undef SubClassConsts_SUPER_INT_CONSTANT\n" +
"#define SubClassConsts_SUPER_INT_CONSTANT 3L\n" +
"#undef SubClassConsts_SUPER_FLOAT_CONSTANT\n" +
@ -71,6 +71,9 @@ public class ConstMacroTest {
"#endif\n" +
"#endif";
private static final String serialVersionUIDSuffix =
ToolBox.isWindows() ? "i64" : "LL"; ;
public static void main(String[] args) throws Exception {
//first steps are now done by jtreg
// cp "${TESTSRC}${FS}SuperClassConsts.java" .
@ -85,8 +88,10 @@ public class ConstMacroTest {
ToolBox.javah(successParams);
// diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
String subClassConstGoldenFile = String.format(subClassConstsGoldenFileTemplate,
serialVersionUIDSuffix);
ToolBox.compareLines(Paths.get("SubClassConsts.h"),
ToolBox.splitLines(SubClassConstsGoldenFile), null);
ToolBox.splitLines(subClassConstGoldenFile, "\n"), null, true);
}
}

View File

@ -84,10 +84,11 @@ public class StackmapTest {
new ToolBox.JavaToolArgs()
.setAllArgs("-v", "Test.class");
String out = ToolBox.javap(javapParams);
List<String> grepResult = ToolBox.grep("frame_type", out);
grepResult.addAll(ToolBox.grep("offset_delta", out));
grepResult.addAll(ToolBox.grep("stack = ", out));
grepResult.addAll(ToolBox.grep("locals = ", out));
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"));
// diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"