@@ -2404,6 +2404,68 @@ void testRemoteFileJavaagentComplex() throws Exception {
24042404 assertThat (result .err , containsString ("-javaagent:" + jar + "=test:" + file ));
24052405 }
24062406
2407+ @ Test
2408+ @ SuppressWarnings ("unchecked" )
2409+ void testRemoteFileXXargs (@ TempDir File output ) throws Exception {
2410+
2411+ wms .stubFor (
2412+ WireMock .get (urlEqualTo ("/flags.json" ))
2413+ .willReturn (aResponse ()
2414+ .withHeader ("Content-Type" , "text/plain" )
2415+ .withBodyFile ("flags.json" )
2416+ .withBody (
2417+ Util .readString (
2418+ examplesTestFolder .resolve ("flags.json" )))));
2419+
2420+ wms .start ();
2421+
2422+ String script = examplesTestFolder .resolve ("helloworld.java" ).toString ();
2423+ String arg = "http://localhost:" + wms .port () + "/flags.json" ;
2424+ CaptureResult <Integer > result = checkedRun (null , "run" , "--verbose" ,
2425+ "-R=-XX:CompilerDirectivesFile=%{" + arg + "}" ,
2426+ script );
2427+ assertThat (result .err , containsString ("Requesting HTTP GET " + arg ));
2428+ Path file = Util .downloadAndCacheFile (arg );
2429+ assertThat (result .err , containsString ("-XX:CompilerDirectivesFile=" + file ));
2430+ }
2431+
2432+ @ Test
2433+ @ SuppressWarnings ("unchecked" )
2434+ void testRemoteFileEmbeddedXXargs (@ TempDir File output ) throws Exception {
2435+
2436+ wms .stubFor (
2437+ WireMock .get (urlEqualTo ("/flags2.json" ))
2438+ .willReturn (aResponse ()
2439+ .withHeader ("Content-Type" , "text/plain" )
2440+ .withBodyFile ("flags2.json" )
2441+ .withBody (
2442+ Util .readString (
2443+ examplesTestFolder .resolve ("flags.json" )))));
2444+
2445+ wms .start ();
2446+ String arg = "http://localhost:" + wms .port () + "/flags2.json" ;
2447+
2448+ String directives = "//RUNTIME_OPTIONS -XX:CompilerDirectivesFile=%{" + arg + "}\n "
2449+ + "class funky { static void main(String args[]) {} }" ;
2450+
2451+ Path f = output .toPath ().resolve ("funky.java" );
2452+
2453+ Util .writeString (f , directives );
2454+
2455+ String script = f .toAbsolutePath ().toString ();
2456+
2457+ CaptureResult <Integer > result = checkedRun (null , "run" , "--verbose" ,
2458+ script );
2459+ assertThat (result .err , containsString ("Requesting HTTP GET " + arg ));
2460+ Path file = Util .downloadAndCacheFile (arg );
2461+ assertThat (result .err , containsString ("-XX:CompilerDirectivesFile=" + file ));
2462+
2463+ }
2464+
2465+ void testRemoteFileEmbeddedInOptions () {
2466+
2467+ }
2468+
24072469 @ Test
24082470 @ SuppressWarnings ("unchecked" )
24092471 void testRemoteFileArgSimpleEscaped () throws Exception {
0 commit comments