Skip to content

Commit 6fd6d0a

Browse files
committed
Reintroduce --macro:junitcp for truffle junit tests
1 parent 9b70e98 commit 6fd6d0a

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file contains support for building a set of junit tests into a native-image
2+
3+
ImageName = svmjunit
4+
5+
ImageClasspath = ${.}/junit-support.jar:${.}/junit-tool.jar:${.}/junit.jar:${.}/hamcrest.jar
6+
7+
Args = -H:Features=com.oracle.svm.junit.JUnitFeature \
8+
-H:Class=com.oracle.svm.junit.SVMJUnitRunner \
9+
-H:TestFile=${*} \
10+
--initialize-at-build-time=org.junit,com.oracle.mxtool.junit.MxJUnitRequest \
11+

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ def dummy_harness(test_deps, vm_launcher, vm_args):
597597
with open(unittest_file, 'r') as f:
598598
mx.log('Building junit image for matching: ' + ' '.join(l.rstrip() for l in f))
599599
extra_image_args = mx.get_runtime_jvm_args(unittest_deps, jdk=mx_compiler.jdk, exclude_names=['substratevm:LIBRARY_SUPPORT'])
600-
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + ['--macro:junit=' + unittest_file, '-H:Path=' + junit_test_dir])
600+
macro_junit = '--macro:junit' + ('' if builder_on_modulepath else 'cp')
601+
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file, '-H:Path=' + junit_test_dir])
601602
mx.log('Running: ' + ' '.join(map(pipes.quote, [unittest_image] + run_args)))
602603
mx.run([unittest_image] + run_args)
603604
finally:
@@ -1069,6 +1070,19 @@ def _native_image_launcher_extra_jvm_args():
10691070
jlink=False,
10701071
))
10711072

1073+
mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro(
1074+
suite=suite,
1075+
name='Native Image JUnit with image-builder on classpath',
1076+
short_name='njucp',
1077+
dir_name='junitcp',
1078+
license_files=[],
1079+
third_party_license_files=[],
1080+
dependencies=['SubstrateVM'],
1081+
jar_distributions=['substratevm:JUNIT_SUPPORT', 'mx:JUNIT_TOOL', 'mx:JUNIT', 'mx:HAMCREST'],
1082+
support_distributions=['substratevm:NATIVE_IMAGE_JUNITCP_SUPPORT'],
1083+
jlink=False,
1084+
))
1085+
10721086
jar_distributions = [
10731087
'substratevm:GRAAL_HOTSPOT_LIBRARY',
10741088
'compiler:GRAAL_TRUFFLE_COMPILER_LIBGRAAL',

substratevm/mx.substratevm/suite.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,15 @@
15971597
},
15981598
},
15991599

1600+
"NATIVE_IMAGE_JUNITCP_SUPPORT" : {
1601+
"native" : True,
1602+
"description" : "Native-image based junit testing support but with running image-builder on classpath",
1603+
"layout" : {
1604+
"native-image.properties" : "file:mx.substratevm/macro-junitcp.properties",
1605+
"svm-junit.packages" : "file:mx.substratevm/svm-junit.packages",
1606+
},
1607+
},
1608+
16001609
"SVM_LLVM" : {
16011610
"subDir" : "src",
16021611
"description" : "LLVM backend for Native Image",

vm/mx.vm/ce-python

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not modify this env file without updating the Graal.Python benchmark builders
22
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,graalpython
3-
COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,js,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,nju,pbm,pmh,poly,polynative,pro,pyn,pynl,rgx,sdk,svm,svml,svmnfi,tfl,tflm,vvm
3+
COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,js,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,nju,njucp,pbm,pmh,poly,polynative,pro,pyn,pynl,rgx,sdk,svm,svml,svmnfi,tfl,tflm,vvm
44
NATIVE_IMAGES=graalpython,lib:jvmcicompiler
55
DISABLE_INSTALLABLES=False

vm/mx.vm/ce-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/sulong,/tools,/truffle
2-
COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,js,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,nju,poly,polynative,pro,rgx,sdk,svm,svml,svmnfi,tfl,tflm,vvm
2+
COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,js,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,nju,njucp,poly,polynative,pro,rgx,sdk,svm,svml,svmnfi,tfl,tflm,vvm
33
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang++,graalvm-native-ld,gu,lib:jsvm,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lli,native-image,native-image-configure
44
DISABLE_INSTALLABLES=llp

vm/mx.vm/mx_vm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
ce_complete_components = ce_aarch64_complete_components + ['ellvm', 'pyn', 'R', 'bRMain', 'pynl']
148148
ce_darwin_aarch64_complete_components = ['bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'ejvm', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'java', 'js', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi', 'nfi-libffi', 'ni', 'nic', 'nil', 'poly', 'polynative', 'pro', 'rgx', 'sdk', 'spolyglot', 'svm', 'svmnfi', 'tfl', 'tflm', 'vvm']
149149
ce_ruby_components = ['cmp', 'cov', 'dap', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'llp', 'llrc', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pro', 'rby', 'rbyl', 'rgx', 'sdk', 'svm', 'svmnfi', 'tfl', 'tflm', 'vvm']
150-
ce_python_components = ['bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang++', 'bgraalvm-native-ld', 'bgu', 'sjsvm', 'blli', 'bnative-image', 'bnative-image-configure', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'js', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'nju', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'spolyglot', 'svm', 'svml', 'svmnfi', 'tfl', 'tflm', 'vvm']
150+
ce_python_components = ['bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang++', 'bgraalvm-native-ld', 'bgu', 'sjsvm', 'blli', 'bnative-image', 'bnative-image-configure', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'js', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'nju', 'njucp', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'spolyglot', 'svm', 'svml', 'svmnfi', 'tfl', 'tflm', 'vvm']
151151
ce_fastr_components = ['R', 'bRMain', 'bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang++', 'bgraalvm-native-ld', 'bgu', 'sjsvm', 'blli', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'js', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'pro', 'rgx', 'sdk', 'spolyglot', 'svm', 'svml', 'svmnfi', 'tfl', 'tflm', 'vvm']
152152
ce_no_native_components = ['bgu', 'sjsvm', 'blli', 'bgraalvm-native-clang', 'bgraalvm-native-clang++', 'bgraalvm-native-ld', 'bgraalvm-native-binutil', 'bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'js', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'polynative', 'pro', 'rgx', 'sdk', 'llrc', 'llrn', 'llrl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'spolyglot', 'svm', 'svmnfi', 'svml', 'tfl', 'tflm', 'libpoly', 'poly', 'vvm']
153153

@@ -176,9 +176,9 @@
176176
mx_sdk_vm.register_vm_config('ce', ['bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang++', 'bgraalvm-native-ld', 'blli', 'bnative-image', 'cmp', 'lg', 'llrc', 'llrl', 'llrn', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pbi', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'tfl', 'tflm'], _suite, env_file='polybench-sulong-ce')
177177

178178
if mx.get_os() == 'windows':
179-
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'tfl', 'tflm'], _suite, env_file=False)
179+
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'tfl', 'tflm'], _suite, env_file=False)
180180
else:
181-
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svml', 'tfl', 'tflm'], _suite, env_file=False)
181+
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svml', 'tfl', 'tflm'], _suite, env_file=False)
182182
# pylint: enable=line-too-long
183183

184184

0 commit comments

Comments
 (0)