Skip to content

Commit ea04d3c

Browse files
committed
Ensure module-path built agents are tested in mx hellomodule
1 parent 14e7f83 commit ea04d3c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,17 +1087,28 @@ def hellomodule(args):
10871087
proj_dir = join(suite.dir, 'src', 'native-image-module-tests', 'hello.app')
10881088
mx.run_maven(['-e', 'install'], cwd=proj_dir)
10891089
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'])
10911091
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:')
10921099
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+
10931106
# Build module into native image
10941107
mx.log('Building image from java modules: ' + str(module_path))
1095-
module_path_sep = ';' if mx.is_windows() else ':'
10961108
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)
11011112
mx.log('Running image ' + built_image + ' built from module:')
11021113
mx.run([built_image])
11031114

0 commit comments

Comments
 (0)