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