46 |
47 |
47 public static void main(String... args) throws Exception { |
48 public static void main(String... args) throws Exception { |
48 new SourceMode().run(args); |
49 new SourceMode().run(args); |
49 } |
50 } |
50 |
51 |
|
52 // to reduce the chance of creating shebang lines that are too long, |
|
53 // we use a relative path to the java command if that is shorter |
|
54 private final Path shortJavaCmd; |
|
55 |
|
56 private final PrintStream log; |
|
57 |
|
58 private final boolean skipShebangTest; |
|
59 |
|
60 SourceMode() { |
|
61 Path cwd = Paths.get(System.getProperty("user.dir")); |
|
62 Path cmd = Paths.get(javaCmd); |
|
63 |
|
64 if (isWindows) { |
|
65 // Skip shebang tests on Windows, because that requires Cygwin. |
|
66 shortJavaCmd = cmd; |
|
67 skipShebangTest = true; |
|
68 } else { |
|
69 // Skip shebang tests if the path to the Java launcher is too long, |
|
70 // because that will cause tests to overflow the mostly undocumented |
|
71 // limit of 120 characters for a shebang line. |
|
72 Path p = cwd.relativize(cmd); |
|
73 shortJavaCmd = (p.toString().length() < cmd.toString().length()) ? p : cmd; |
|
74 skipShebangTest = shortJavaCmd.toString().length() > 100; |
|
75 } |
|
76 |
|
77 log = System.err; |
|
78 } |
|
79 |
51 // java Simple.java 1 2 3 |
80 // java Simple.java 1 2 3 |
52 @Test |
81 @Test |
53 void testSimpleJava() throws IOException { |
82 void testSimpleJava() throws IOException { |
|
83 starting("testSimpleJava"); |
54 Path file = getSimpleFile("Simple.java", false); |
84 Path file = getSimpleFile("Simple.java", false); |
55 TestResult tr = doExec(javaCmd, file.toString(), "1", "2", "3"); |
85 TestResult tr = doExec(javaCmd, file.toString(), "1", "2", "3"); |
56 if (!tr.isOK()) |
86 if (!tr.isOK()) |
57 error(tr, "Bad exit code: " + tr.exitValue); |
87 error(tr, "Bad exit code: " + tr.exitValue); |
58 if (!tr.contains("[1, 2, 3]")) |
88 if (!tr.contains("[1, 2, 3]")) |
59 error(tr, "Expected output not found"); |
89 error(tr, "Expected output not found"); |
60 System.out.println(tr.testOutput); |
90 show(tr); |
61 } |
91 } |
62 |
92 |
63 // java --source 10 simple 1 2 3 |
93 // java --source 10 simple 1 2 3 |
64 @Test |
94 @Test |
65 void testSimple() throws IOException { |
95 void testSimple() throws IOException { |
|
96 starting("testSimple"); |
66 Path file = getSimpleFile("simple", false); |
97 Path file = getSimpleFile("simple", false); |
67 TestResult tr = doExec(javaCmd, "--source", "10", file.toString(), "1", "2", "3"); |
98 TestResult tr = doExec(javaCmd, "--source", "10", file.toString(), "1", "2", "3"); |
68 if (!tr.isOK()) |
99 if (!tr.isOK()) |
69 error(tr, "Bad exit code: " + tr.exitValue); |
100 error(tr, "Bad exit code: " + tr.exitValue); |
70 if (!tr.contains("[1, 2, 3]")) |
101 if (!tr.contains("[1, 2, 3]")) |
71 error(tr, "Expected output not found"); |
102 error(tr, "Expected output not found"); |
72 System.out.println(tr.testOutput); |
103 show(tr); |
73 } |
104 } |
74 |
105 |
75 // execSimple 1 2 3 |
106 // execSimple 1 2 3 |
76 @Test |
107 @Test |
77 void testExecSimple() throws IOException { |
108 void testExecSimple() throws IOException { |
78 if (isWindows) // Will not work without cygwin, pass silently |
109 starting("testExecSimple"); |
|
110 if (skipShebangTest) { |
|
111 log.println("SKIPPED"); |
79 return; |
112 return; |
|
113 } |
80 Path file = setExecutable(getSimpleFile("execSimple", true)); |
114 Path file = setExecutable(getSimpleFile("execSimple", true)); |
81 TestResult tr = doExec(file.toAbsolutePath().toString(), "1", "2", "3"); |
115 TestResult tr = doExec(file.toAbsolutePath().toString(), "1", "2", "3"); |
82 if (!tr.isOK()) |
116 if (!tr.isOK()) |
83 error(tr, "Bad exit code: " + tr.exitValue); |
117 error(tr, "Bad exit code: " + tr.exitValue); |
84 if (!tr.contains("[1, 2, 3]")) |
118 if (!tr.contains("[1, 2, 3]")) |
85 error(tr, "Expected output not found"); |
119 error(tr, "Expected output not found"); |
86 System.out.println(tr.testOutput); |
120 show(tr); |
87 } |
121 } |
88 |
122 |
89 // java @simpleJava.at (contains Simple.java 1 2 3) |
123 // java @simpleJava.at (contains Simple.java 1 2 3) |
90 @Test |
124 @Test |
91 void testSimpleJavaAtFile() throws IOException { |
125 void testSimpleJavaAtFile() throws IOException { |
|
126 starting("testSimpleJavaAtFile"); |
92 Path file = getSimpleFile("Simple.java", false); |
127 Path file = getSimpleFile("Simple.java", false); |
93 Path atFile = Paths.get("simpleJava.at"); |
128 Path atFile = Paths.get("simpleJava.at"); |
94 createFile(atFile.toFile(), List.of(file + " 1 2 3")); |
129 createFile(atFile, List.of(file + " 1 2 3")); |
95 TestResult tr = doExec(javaCmd, "@" + atFile); |
130 TestResult tr = doExec(javaCmd, "@" + atFile); |
96 if (!tr.isOK()) |
131 if (!tr.isOK()) |
97 error(tr, "Bad exit code: " + tr.exitValue); |
132 error(tr, "Bad exit code: " + tr.exitValue); |
98 if (!tr.contains("[1, 2, 3]")) |
133 if (!tr.contains("[1, 2, 3]")) |
99 error(tr, "Expected output not found"); |
134 error(tr, "Expected output not found"); |
100 System.out.println(tr.testOutput); |
135 show(tr); |
101 } |
136 } |
102 |
137 |
103 // java @simple.at (contains --source 10 simple 1 2 3) |
138 // java @simple.at (contains --source 10 simple 1 2 3) |
104 @Test |
139 @Test |
105 void testSimpleAtFile() throws IOException { |
140 void testSimpleAtFile() throws IOException { |
|
141 starting("testSimpleAtFile"); |
106 Path file = getSimpleFile("simple", false); |
142 Path file = getSimpleFile("simple", false); |
107 Path atFile = Paths.get("simple.at"); |
143 Path atFile = Paths.get("simple.at"); |
108 createFile(atFile.toFile(), List.of("--source 10 " + file + " 1 2 3")); |
144 createFile(atFile, List.of("--source 10 " + file + " 1 2 3")); |
109 TestResult tr = doExec(javaCmd, "@" + atFile); |
145 TestResult tr = doExec(javaCmd, "@" + atFile); |
110 if (!tr.isOK()) |
146 if (!tr.isOK()) |
111 error(tr, "Bad exit code: " + tr.exitValue); |
147 error(tr, "Bad exit code: " + tr.exitValue); |
112 if (!tr.contains("[1, 2, 3]")) |
148 if (!tr.contains("[1, 2, 3]")) |
113 error(tr, "Expected output not found"); |
149 error(tr, "Expected output not found"); |
114 System.out.println(tr.testOutput); |
150 show(tr); |
115 } |
151 } |
116 |
152 |
117 // java -cp classes Main.java 1 2 3 |
153 // java -cp classes Main.java 1 2 3 |
118 @Test |
154 @Test |
119 void testClasspath() throws IOException { |
155 void testClasspath() throws IOException { |
|
156 starting("testClasspath"); |
120 Path base = Files.createDirectories(Paths.get("testClasspath")); |
157 Path base = Files.createDirectories(Paths.get("testClasspath")); |
121 Path otherJava = base.resolve("Other.java"); |
158 Path otherJava = base.resolve("Other.java"); |
122 createFile(otherJava.toFile(), List.of( |
159 createFile(otherJava, List.of( |
123 "public class Other {", |
160 "public class Other {", |
124 " public static String join(String[] args) {", |
161 " public static String join(String[] args) {", |
125 " return String.join(\"-\", args);", |
162 " return String.join(\"-\", args);", |
126 " }", |
163 " }", |
127 "}" |
164 "}" |
128 )); |
165 )); |
129 Path classes = Files.createDirectories(base.resolve("classes")); |
166 Path classes = Files.createDirectories(base.resolve("classes")); |
130 Path mainJava = base.resolve("Main.java"); |
167 Path mainJava = base.resolve("Main.java"); |
131 createFile(mainJava.toFile(), List.of( |
168 createFile(mainJava, List.of( |
132 "class Main {", |
169 "class Main {", |
133 " public static void main(String[] args) {", |
170 " public static void main(String[] args) {", |
134 " System.out.println(Other.join(args));", |
171 " System.out.println(Other.join(args));", |
135 " }}" |
172 " }}" |
136 )); |
173 )); |
139 mainJava.toString(), "1", "2", "3"); |
176 mainJava.toString(), "1", "2", "3"); |
140 if (!tr.isOK()) |
177 if (!tr.isOK()) |
141 error(tr, "Bad exit code: " + tr.exitValue); |
178 error(tr, "Bad exit code: " + tr.exitValue); |
142 if (!tr.contains("1-2-3")) |
179 if (!tr.contains("1-2-3")) |
143 error(tr, "Expected output not found"); |
180 error(tr, "Expected output not found"); |
144 System.out.println(tr.testOutput); |
181 show(tr); |
145 } |
182 } |
146 |
183 |
147 // java --add-exports=... Export.java --help |
184 // java --add-exports=... Export.java --help |
148 @Test |
185 @Test |
149 void testAddExports() throws IOException { |
186 void testAddExports() throws IOException { |
|
187 starting("testAddExports"); |
150 Path exportJava = Paths.get("Export.java"); |
188 Path exportJava = Paths.get("Export.java"); |
151 createFile(exportJava.toFile(), List.of( |
189 createFile(exportJava, List.of( |
152 "public class Export {", |
190 "public class Export {", |
153 " public static void main(String[] args) {", |
191 " public static void main(String[] args) {", |
154 " new com.sun.tools.javac.main.Main(\"demo\").compile(args);", |
192 " new com.sun.tools.javac.main.Main(\"demo\").compile(args);", |
155 " }", |
193 " }", |
156 "}" |
194 "}" |
157 )); |
195 )); |
158 // verify access fails without --add-exports |
196 // verify access fails without --add-exports |
159 TestResult tr1 = doExec(javaCmd, exportJava.toString(), "--help"); |
197 TestResult tr1 = doExec(javaCmd, exportJava.toString(), "--help"); |
160 if (tr1.isOK()) |
198 if (tr1.isOK()) |
161 error(tr1, "Compilation succeeded unexpectedly"); |
199 error(tr1, "Compilation succeeded unexpectedly"); |
|
200 show(tr1); |
162 // verify access succeeds with --add-exports |
201 // verify access succeeds with --add-exports |
163 TestResult tr2 = doExec(javaCmd, |
202 TestResult tr2 = doExec(javaCmd, |
164 "--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", |
203 "--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", |
165 exportJava.toString(), "--help"); |
204 exportJava.toString(), "--help"); |
166 if (!tr2.isOK()) |
205 if (!tr2.isOK()) |
167 error(tr2, "Bad exit code: " + tr2.exitValue); |
206 error(tr2, "Bad exit code: " + tr2.exitValue); |
168 if (!(tr2.contains("demo") && tr2.contains("Usage"))) |
207 if (!(tr2.contains("demo") && tr2.contains("Usage"))) |
169 error(tr2, "Expected output not found"); |
208 error(tr2, "Expected output not found"); |
|
209 show(tr2); |
170 } |
210 } |
171 |
211 |
172 // java -cp ... HelloWorld.java (for a class "java" in package "HelloWorld") |
212 // java -cp ... HelloWorld.java (for a class "java" in package "HelloWorld") |
173 @Test |
213 @Test |
174 void testClassNamedJava() throws IOException { |
214 void testClassNamedJava() throws IOException { |
|
215 starting("testClassNamedJava"); |
175 Path base = Files.createDirectories(Paths.get("testClassNamedJava")); |
216 Path base = Files.createDirectories(Paths.get("testClassNamedJava")); |
176 Path src = Files.createDirectories(base.resolve("src")); |
217 Path src = Files.createDirectories(base.resolve("src")); |
177 Path srcfile = src.resolve("java.java"); |
218 Path srcfile = src.resolve("java.java"); |
178 createFile(srcfile.toFile(), List.of( |
219 createFile(srcfile, List.of( |
179 "package HelloWorld;", |
220 "package HelloWorld;", |
180 "class java {", |
221 "class java {", |
181 " public static void main(String... args) {", |
222 " public static void main(String... args) {", |
182 " System.out.println(HelloWorld.java.class.getName());", |
223 " System.out.println(HelloWorld.java.class.getName());", |
183 " }", |
224 " }", |
189 doExec(javaCmd, "-cp", classes.toString(), "HelloWorld.java"); |
230 doExec(javaCmd, "-cp", classes.toString(), "HelloWorld.java"); |
190 if (!tr.isOK()) |
231 if (!tr.isOK()) |
191 error(tr, "Command failed"); |
232 error(tr, "Command failed"); |
192 if (!tr.contains("HelloWorld.java")) |
233 if (!tr.contains("HelloWorld.java")) |
193 error(tr, "Expected output not found"); |
234 error(tr, "Expected output not found"); |
|
235 show(tr); |
194 } |
236 } |
195 |
237 |
196 // java --source |
238 // java --source |
197 @Test |
239 @Test |
198 void testSourceNoArg() throws IOException { |
240 void testSourceNoArg() throws IOException { |
|
241 starting("testSourceNoArg"); |
199 TestResult tr = doExec(javaCmd, "--source"); |
242 TestResult tr = doExec(javaCmd, "--source"); |
200 if (tr.isOK()) |
243 if (tr.isOK()) |
201 error(tr, "Command succeeded unexpectedly"); |
244 error(tr, "Command succeeded unexpectedly"); |
202 System.err.println(tr); |
|
203 if (!tr.contains("--source requires source version")) |
245 if (!tr.contains("--source requires source version")) |
204 error(tr, "Expected output not found"); |
246 error(tr, "Expected output not found"); |
|
247 show(tr); |
205 } |
248 } |
206 |
249 |
207 // java --source 10 -jar simple.jar |
250 // java --source 10 -jar simple.jar |
208 @Test |
251 @Test |
209 void testSourceJarConflict() throws IOException { |
252 void testSourceJarConflict() throws IOException { |
|
253 starting("testSourceJarConflict"); |
210 Path base = Files.createDirectories(Paths.get("testSourceJarConflict")); |
254 Path base = Files.createDirectories(Paths.get("testSourceJarConflict")); |
211 Path file = getSimpleFile("Simple.java", false); |
255 Path file = getSimpleFile("Simple.java", false); |
212 Path classes = Files.createDirectories(base.resolve("classes")); |
256 Path classes = Files.createDirectories(base.resolve("classes")); |
213 compile("-d", classes.toString(), file.toString()); |
257 compile("-d", classes.toString(), file.toString()); |
214 Path simpleJar = base.resolve("simple.jar"); |
258 Path simpleJar = base.resolve("simple.jar"); |
217 doExec(javaCmd, "--source", "10", "-jar", simpleJar.toString()); |
261 doExec(javaCmd, "--source", "10", "-jar", simpleJar.toString()); |
218 if (tr.isOK()) |
262 if (tr.isOK()) |
219 error(tr, "Command succeeded unexpectedly"); |
263 error(tr, "Command succeeded unexpectedly"); |
220 if (!tr.contains("Option -jar is not allowed with --source")) |
264 if (!tr.contains("Option -jar is not allowed with --source")) |
221 error(tr, "Expected output not found"); |
265 error(tr, "Expected output not found"); |
|
266 show(tr); |
222 } |
267 } |
223 |
268 |
224 // java --source 10 -m jdk.compiler |
269 // java --source 10 -m jdk.compiler |
225 @Test |
270 @Test |
226 void testSourceModuleConflict() throws IOException { |
271 void testSourceModuleConflict() throws IOException { |
|
272 starting("testSourceModuleConflict"); |
227 TestResult tr = doExec(javaCmd, "--source", "10", "-m", "jdk.compiler"); |
273 TestResult tr = doExec(javaCmd, "--source", "10", "-m", "jdk.compiler"); |
228 if (tr.isOK()) |
274 if (tr.isOK()) |
229 error(tr, "Command succeeded unexpectedly"); |
275 error(tr, "Command succeeded unexpectedly"); |
230 if (!tr.contains("Option -m is not allowed with --source")) |
276 if (!tr.contains("Option -m is not allowed with --source")) |
231 error(tr, "Expected output not found"); |
277 error(tr, "Expected output not found"); |
|
278 show(tr); |
232 } |
279 } |
233 |
280 |
234 // #!.../java --source 10 -version |
281 // #!.../java --source 10 -version |
235 @Test |
282 @Test |
236 void testTerminalOptionInShebang() throws IOException { |
283 void testTerminalOptionInShebang() throws IOException { |
237 if (isWindows) // Will not work without cygwin, pass silently |
284 starting("testTerminalOptionInShebang"); |
|
285 if (skipShebangTest) { |
|
286 log.println("SKIPPED"); |
238 return; |
287 return; |
|
288 } |
239 Path base = Files.createDirectories( |
289 Path base = Files.createDirectories( |
240 Paths.get("testTerminalOptionInShebang")); |
290 Paths.get("testTerminalOptionInShebang")); |
241 Path bad = base.resolve("bad"); |
291 Path bad = base.resolve("bad"); |
242 createFile(bad.toFile(), List.of( |
292 createFile(bad, List.of( |
243 "#!" + javaCmd + " --source 10 -version")); |
293 "#!" + shortJavaCmd + " --source 10 -version")); |
244 setExecutable(bad); |
294 setExecutable(bad); |
245 TestResult tr = doExec(bad.toString()); |
295 TestResult tr = doExec(bad.toString()); |
246 if (!tr.contains("Option -version is not allowed in this context")) |
296 if (!tr.contains("Option -version is not allowed in this context")) |
247 error(tr, "Expected output not found"); |
297 error(tr, "Expected output not found"); |
|
298 show(tr); |
248 } |
299 } |
249 |
300 |
250 // #!.../java --source 10 @bad.at (contains -version) |
301 // #!.../java --source 10 @bad.at (contains -version) |
251 @Test |
302 @Test |
252 void testTerminalOptionInShebangAtFile() throws IOException { |
303 void testTerminalOptionInShebangAtFile() throws IOException { |
253 if (isWindows) // Will not work without cygwin, pass silently |
304 starting("testTerminalOptionInShebangAtFile"); |
|
305 if (skipShebangTest) { |
|
306 log.println("SKIPPED"); |
254 return; |
307 return; |
|
308 } |
255 // Use a short directory name, to avoid line length limitations |
309 // Use a short directory name, to avoid line length limitations |
256 Path base = Files.createDirectories(Paths.get("testBadAtFile")); |
310 Path base = Files.createDirectories(Paths.get("testBadAtFile")); |
257 Path bad_at = base.resolve("bad.at"); |
311 Path bad_at = base.resolve("bad.at"); |
258 createFile(bad_at.toFile(), List.of("-version")); |
312 createFile(bad_at, List.of("-version")); |
259 Path bad = base.resolve("bad"); |
313 Path bad = base.resolve("bad"); |
260 createFile(bad.toFile(), List.of( |
314 createFile(bad, List.of( |
261 "#!" + javaCmd + " --source 10 @" + bad_at)); |
315 "#!" + shortJavaCmd + " --source 10 @" + bad_at)); |
262 setExecutable(bad); |
316 setExecutable(bad); |
263 TestResult tr = doExec(bad.toString()); |
317 TestResult tr = doExec(bad.toString()); |
264 System.err.println("JJG JJG " + tr); |
|
265 if (!tr.contains("Option -version in @testBadAtFile/bad.at is " |
318 if (!tr.contains("Option -version in @testBadAtFile/bad.at is " |
266 + "not allowed in this context")) |
319 + "not allowed in this context")) |
267 error(tr, "Expected output not found"); |
320 error(tr, "Expected output not found"); |
|
321 show(tr); |
268 } |
322 } |
269 |
323 |
270 // #!.../java --source 10 HelloWorld |
324 // #!.../java --source 10 HelloWorld |
271 @Test |
325 @Test |
272 void testMainClassInShebang() throws IOException { |
326 void testMainClassInShebang() throws IOException { |
273 if (isWindows) // Will not work without cygwin, pass silently |
327 starting("testMainClassInShebang"); |
|
328 if (skipShebangTest) { |
|
329 log.println("SKIPPED"); |
274 return; |
330 return; |
|
331 } |
275 Path base = Files.createDirectories(Paths.get("testMainClassInShebang")); |
332 Path base = Files.createDirectories(Paths.get("testMainClassInShebang")); |
276 Path bad = base.resolve("bad"); |
333 Path bad = base.resolve("bad"); |
277 createFile(bad.toFile(), List.of( |
334 createFile(bad, List.of( |
278 "#!" + javaCmd + " --source 10 HelloWorld")); |
335 "#!" + shortJavaCmd + " --source 10 HelloWorld")); |
279 setExecutable(bad); |
336 setExecutable(bad); |
280 TestResult tr = doExec(bad.toString()); |
337 TestResult tr = doExec(bad.toString()); |
281 if (!tr.contains("Cannot specify main class in this context")) |
338 if (!tr.contains("Cannot specify main class in this context")) |
282 error(tr, "Expected output not found"); |
339 error(tr, "Expected output not found"); |
|
340 show(tr); |
283 } |
341 } |
284 |
342 |
285 //-------------------------------------------------------------------------- |
343 //-------------------------------------------------------------------------- |
|
344 |
|
345 private void starting(String label) { |
|
346 System.out.println(); |
|
347 System.out.println("*** Starting: " + label + " (stdout)"); |
|
348 |
|
349 System.err.println(); |
|
350 System.err.println("*** Starting: " + label + " (stderr)"); |
|
351 } |
|
352 |
|
353 private void show(TestResult tr) { |
|
354 log.println("*** Test Output:"); |
|
355 for (String line: tr.testOutput) { |
|
356 log.println(line); |
|
357 } |
|
358 log.println("*** End Of Test Output:"); |
|
359 } |
286 |
360 |
287 private Map<String,String> getLauncherDebugEnv() { |
361 private Map<String,String> getLauncherDebugEnv() { |
288 return Map.of("_JAVA_LAUNCHER_DEBUG", "1"); |
362 return Map.of("_JAVA_LAUNCHER_DEBUG", "1"); |
289 } |
363 } |
290 |
364 |
291 private Path getSimpleFile(String name, boolean shebang) throws IOException { |
365 private Path getSimpleFile(String name, boolean shebang) throws IOException { |
292 Path file = Paths.get(name); |
366 Path file = Paths.get(name); |
293 if (!Files.exists(file)) { |
367 if (!Files.exists(file)) { |
294 createFile(file.toFile(), List.of( |
368 createFile(file, List.of( |
295 (shebang ? "#!" + javaCmd + " --source 10" : ""), |
369 (shebang ? "#!" + shortJavaCmd + " --source 10" : ""), |
296 "public class Simple {", |
370 "public class Simple {", |
297 " public static void main(String[] args) {", |
371 " public static void main(String[] args) {", |
298 " System.out.println(java.util.Arrays.toString(args));", |
372 " System.out.println(java.util.Arrays.toString(args));", |
299 " }}")); |
373 " }}")); |
300 } |
374 } |
301 return file; |
375 return file; |
|
376 } |
|
377 |
|
378 private void createFile(Path file, List<String> lines) throws IOException { |
|
379 lines.stream() |
|
380 .filter(line -> line.length() > 128) |
|
381 .forEach(line -> { |
|
382 log.println("*** Warning: long line (" |
|
383 + line.length() |
|
384 + " chars) in file " + file); |
|
385 log.println("*** " + line); |
|
386 }); |
|
387 log.println("*** File: " + file); |
|
388 lines.stream().forEach(log::println); |
|
389 log.println("*** End Of File"); |
|
390 createFile(file.toFile(), lines); |
302 } |
391 } |
303 |
392 |
304 private Path setExecutable(Path file) throws IOException { |
393 private Path setExecutable(Path file) throws IOException { |
305 Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file); |
394 Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file); |
306 perms.add(PosixFilePermission.OWNER_EXECUTE); |
395 perms.add(PosixFilePermission.OWNER_EXECUTE); |
307 Files.setPosixFilePermissions(file, perms); |
396 Files.setPosixFilePermissions(file, perms); |
308 return file; |
397 return file; |
309 } |
398 } |
310 |
399 |
311 private void error(TestResult tr, String message) { |
400 private void error(TestResult tr, String message) { |
312 System.err.println(tr); |
401 show(tr); |
313 throw new RuntimeException(message); |
402 throw new RuntimeException(message); |
314 } |
403 } |
315 } |
404 } |