< prev index next >

test/jdk/tools/launcher/ArgFileSyntax.java

Print this page

        

*** 21,31 **** * questions. */ /** * @test ! * @bug 8027634 8210810 * @summary Verify syntax of argument file * @build TestHelper * @run main ArgFileSyntax */ import java.io.File; --- 21,31 ---- * questions. */ /** * @test ! * @bug 8027634 8210810 8240629 * @summary Verify syntax of argument file * @build TestHelper * @run main ArgFileSyntax */ import java.io.File;
*** 34,44 **** import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - import java.util.regex.Matcher; import java.util.regex.Pattern; public class ArgFileSyntax extends TestHelper { // Buffer size in args.c readArgFile() method private static final int ARG_FILE_PARSER_BUF_SIZE = 4096; --- 34,43 ----
*** 212,221 **** --- 211,251 ---- String filling = String.valueOf(data); scratch.add(bag + "'" + filling + "\\\\aaa\\\\'"); scratch.add(ver); rv.add(List.of(scratch, List.of(bag + filling + "\\aaa\\", ver))); + // 8240629: position comment at boundary + final int bytesPerLine = 128; + data = new char[bytesPerLine]; + data[0] = '#'; + Arrays.fill(data, 1, data.length, '0'); + filling = String.valueOf(data, 0, bytesPerLine - System.lineSeparator().length()) ; + int lines = ARG_FILE_PARSER_BUF_SIZE / bytesPerLine; + int need = ARG_FILE_PARSER_BUF_SIZE % bytesPerLine; + if (need == 0) { + lines -= 1; + need = filling.length(); + } else { + need -= System.lineSeparator().length(); + } + // Construct args + scratch = new ArrayList<>(); + while (lines > 0) { + scratch.add(filling); + lines--; + } + + Arrays.fill(data, '#'); + // Comment end before, at, after boundary + for (int count = need - 1; count <= need + 1 ; count++) { + String commentAtBoundary = String.valueOf(data, 0, count); + List<String> content = new ArrayList<>(); + content.addAll(scratch); + content.add(commentAtBoundary); + content.add("-Dfoo=bar"); + rv.add(List.of(content, List.of("-Dfoo=bar"))); + } return rv; } // ensure the arguments in the file are read in correctly private void verifyParsing(List<String> lines, List<String> args) throws IOException {
< prev index next >