Skip to content

Commit 09bb627

Browse files
committed
Ensure module-path built agents are tested in mx hellomodule
1 parent af4d956 commit 09bb627

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

0 commit comments

Comments
 (0)