@@ -1086,17 +1086,28 @@ def hellomodule(args):
10861086 proj_dir = join (suite .dir , 'src' , 'native-image-module-tests' , 'hello.app' )
10871087 mx .run_maven (['-e' , 'install' ], cwd = proj_dir )
10881088 module_path .append (join (proj_dir , 'target' , 'hello-app-1.0-SNAPSHOT.jar' ))
1089- config = GraalVMConfig .build (native_images = ['native-image' ])
1089+ config = GraalVMConfig .build (native_images = ['native-image' , 'lib:native-image-agent' , 'lib:native-image-diagnostics-agent' ])
10901090 with native_image_context (hosted_assertions = False , config = config ) as native_image :
1091+ module_path_sep = ';' if mx .is_windows () else ':'
1092+ moduletest_run_args = [
1093+ '--add-exports=moduletests.hello.lib/hello.privateLib=moduletests.hello.app' ,
1094+ '--add-opens=moduletests.hello.lib/hello.privateLib2=moduletests.hello.app' ,
1095+ '-p' , module_path_sep .join (module_path ), '-m' , 'moduletests.hello.app'
1096+ ]
1097+ mx .log ('Running module-tests on JVM:' )
10911098 build_dir = join (svmbuild_dir (), 'hellomodule' )
1099+ mx .run ([
1100+ vm_executable_path ('java' , config ),
1101+ # also test if native-image-agent works
1102+ '-agentlib:native-image-agent=config-output-dir=' + join (build_dir , 'config-output-dir-{pid}-{datetime}/' ),
1103+ ] + moduletest_run_args )
1104+
10921105 # Build module into native image
10931106 mx .log ('Building image from java modules: ' + str (module_path ))
1094- module_path_sep = ';' if mx .is_windows () else ':'
10951107 built_image = native_image ([
1096- '--verbose' , '-ea' , '-H:Path=' + build_dir ,
1097- '--add-exports=moduletests.hello.lib/hello.privateLib=moduletests.hello.app' ,
1098- '--add-exports=moduletests.hello.lib/hello.privateLib2=moduletests.hello.app' ,
1099- '-p' , module_path_sep .join (module_path ), '-m' , 'moduletests.hello.app' ])
1108+ '--verbose' , '-H:Path=' + build_dir ,
1109+ '--trace-class-initialization=hello.lib.Greeter' , # also test native-image-diagnostics-agent
1110+ ] + moduletest_run_args )
11001111 mx .log ('Running image ' + built_image + ' built from module:' )
11011112 mx .run ([built_image ])
11021113
0 commit comments