Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8273361: InfoOptsTest is failing in tier1 #5381

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions test/langtools/tools/javac/options/modes/InfoOptsTest.java
Original file line number Diff line number Diff line change
@@ -69,19 +69,23 @@ void testInfoOpt(String opt, String... expect) {

@Test
void testUniqueInfoOpts() throws IOException {
testUniqueInfoOpt(new String[] {"--help", "--help"}, "possible options");
testUniqueInfoOpt(new String[] {"-X", "-X"}, "extra options");
testUniqueInfoOpt(new String[] {"--help-lint", "--help-lint"}, "supported keys");
testUniqueInfoOpt(new String[] {"--help"}, new String[] {"--help", "--help"});
testUniqueInfoOpt(new String[] {"-X"}, new String[] {"-X", "-X"});
testUniqueInfoOpt(new String[] {"--help-lint"}, new String[] {"--help-lint", "--help-lint"});

String specVersion = System.getProperty("java.specification.version");
testUniqueInfoOpt(new String[] {"-version", "-version"}, "javac", specVersion);
testUniqueInfoOpt(new String[] {"-fullversion", "-fullversion"}, "javac", specVersion);
testUniqueInfoOpt(new String[] {"-version"}, new String[] {"-version", "-version"});
testUniqueInfoOpt(new String[] {"-fullversion"}, new String[] {"-fullversion", "-fullversion"});
}

void testUniqueInfoOpt(String[] opts, String... expect) {
void testUniqueInfoOpt(String[] baseOpts, String[] testOpts) {
String[] files = { };
runMain(opts, files)
.checkOK()
.checkUniqueLog(expect);

TestResult base = runMain(baseOpts, files)
.checkOK();

TestResult test = runMain(testOpts, files)
.checkOK();

base.checkSameLog(test);
}
}
17 changes: 7 additions & 10 deletions test/langtools/tools/javac/options/modes/OptionModesTester.java
Original file line number Diff line number Diff line change
@@ -269,18 +269,15 @@ TestResult checkLog(Log l, String... expects) {
return this;
}

TestResult checkUniqueLog(String... uniqueExpects) {
return checkUniqueLog(Log.DIRECT, uniqueExpects);
TestResult checkSameLog(TestResult other) {
return checkSameLog(Log.DIRECT, other);
}

TestResult checkUniqueLog(Log l, String... uniqueExpects) {
String log = logs.get(l);
for (String e : uniqueExpects) {
if (!log.contains(e)) {
error("Expected string not found: " + e);
} else if (log.indexOf(e) != log.lastIndexOf(e)) {
error("Expected string appears more than once: " + e);
}
TestResult checkSameLog(Log l, TestResult other) {
String thisLog = logs.get(l);
String otherLog = other.logs.get(l);
if (!thisLog.equals(otherLog)) {
error("Logs are not the same.\nThis:\n" + thisLog + "\nOther:\n" + otherLog);
}
return this;
}