diff -r 149dc554808c -r 707553fcca04 test/jdk/tools/launcher/ToolsOpts.java --- a/test/jdk/tools/launcher/ToolsOpts.java Thu Apr 05 23:46:05 2018 +0200 +++ b/test/jdk/tools/launcher/ToolsOpts.java Thu Apr 05 17:04:16 2018 -0700 @@ -184,7 +184,6 @@ break; } - String[] output = tr.testOutput.toArray(new String[tr.testOutput.size()]); //-Joptions should not be passed to tool if (jpos > -1) { checkJoptionOutput(tr, arg); @@ -194,14 +193,23 @@ + "CMD: " + cmdString); } } else { - //check that each non -J option was passed to tool. + // check that each non -J option was passed to tool. It looks for each arg in the output. + // Irrelevant lines in the output are skipped. Arguments order is checked as well. + int j = 0; + List output = tr.testOutput; for (int i = 0; i < arg.length; i++) { - if (output[i].compareTo(arg[i]) != 0) { + boolean found = false; + for (; j < output.size(); j++) { + if (output.get(j).equals(arg[i])) { + pass("check " + output.get(j) + " == " + arg[i]); + found = true; + break; + } + } + if (!found) { throw new RuntimeException( - "failed! CMD: " + cmdString + "\n case:" + - output[i] + " != " + arg[i]); - } else { - pass("check " + output[i] + " == " + arg[i]); + "failed! Should have passed non -J option [" + arg[i] + "] to tool.\n" + + "CMD: " + cmdString); } } }