Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Dec 19, 2024
2 parents 1997ea6 + aa5db3f commit 90d556e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 54 deletions.
13 changes: 0 additions & 13 deletions substratevm/mx.substratevm/macro-junitcp.properties

This file was deleted.

28 changes: 4 additions & 24 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def batched(iterable, n):
yield batch


def _native_junit(native_image, unittest_args, build_args=None, run_args=None, blacklist=None, whitelist=None, preserve_image=False, force_builder_on_cp=False, test_classes_per_run=None):
def _native_junit(native_image, unittest_args, build_args=None, run_args=None, blacklist=None, whitelist=None, preserve_image=False, test_classes_per_run=None):
build_args = build_args or []
javaProperties = {}
for dist in suite.dists:
Expand Down Expand Up @@ -675,13 +675,7 @@ def dummy_harness(test_deps, vm_launcher, vm_args):
mx.log('Building junit image for matching: ' + ' '.join(test_classes))
extra_image_args = mx.get_runtime_jvm_args(unittest_deps, jdk=mx_compiler.jdk, exclude_names=mx_sdk_vm_impl.NativePropertiesBuildTask.implicit_excludes)
macro_junit = '--macro:junit'
if force_builder_on_cp:
macro_junit += 'cp'
custom_env = os.environ.copy()
custom_env['USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM'] = 'false'
else:
custom_env = None
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file] + svm_experimental_options(['-H:Path=' + junit_test_dir]), env=custom_env)
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file] + svm_experimental_options(['-H:Path=' + junit_test_dir]))
image_pattern_replacement = unittest_image + ".exe" if mx.is_windows() else unittest_image
run_args = [arg.replace('${unittest.image}', image_pattern_replacement) for arg in run_args]
mx.log('Running: ' + ' '.join(map(shlex.quote, [unittest_image] + run_args)))
Expand Down Expand Up @@ -719,15 +713,14 @@ def unmask(args):

def _native_unittest(native_image, cmdline_args):
parser = ArgumentParser(prog='mx native-unittest', description='Run unittests as native image.')
all_args = ['--build-args', '--run-args', '--blacklist', '--whitelist', '-p', '--preserve-image', '--force-builder-on-cp', '--test-classes-per-run']
all_args = ['--build-args', '--run-args', '--blacklist', '--whitelist', '-p', '--preserve-image', '--test-classes-per-run']
cmdline_args = [_mask(arg, all_args) for arg in cmdline_args]
parser.add_argument(all_args[0], metavar='ARG', nargs='*', default=[])
parser.add_argument(all_args[1], metavar='ARG', nargs='*', default=[])
parser.add_argument('--blacklist', help='run all testcases not specified in <file>', metavar='<file>')
parser.add_argument('--whitelist', help='run testcases specified in <file> only', metavar='<file>')
parser.add_argument('-p', '--preserve-image', help='do not delete the generated native image', action='store_true')
parser.add_argument('--test-classes-per-run', help='run N test classes per image run, instead of all tests at once', nargs=1, type=int)
parser.add_argument('--force-builder-on-cp', help='force image builder to run on classpath', action='store_true')
parser.add_argument('unittest_args', metavar='TEST_ARG', nargs='*')
pargs = parser.parse_args(cmdline_args)

Expand All @@ -749,7 +742,7 @@ def _native_unittest(native_image, cmdline_args):
mx.log('warning: could not read blacklist: ' + blacklist)

unittest_args = unmask(pargs.unittest_args) if unmask(pargs.unittest_args) else ['com.oracle.svm.test', 'com.oracle.svm.configure.test']
_native_junit(native_image, unittest_args, unmask(pargs.build_args), unmask(pargs.run_args), blacklist, whitelist, pargs.preserve_image, pargs.force_builder_on_cp, test_classes_per_run)
_native_junit(native_image, unittest_args, unmask(pargs.build_args), unmask(pargs.run_args), blacklist, whitelist, pargs.preserve_image, test_classes_per_run)


def jvm_unittest(args):
Expand Down Expand Up @@ -1467,19 +1460,6 @@ def _native_image_launcher_extra_jvm_args():
jlink=False,
))

mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro(
suite=suite,
name='Native Image JUnit with image-builder on classpath',
short_name='njucp',
dir_name='junitcp',
license_files=[],
third_party_license_files=[],
dependencies=['SubstrateVM'],
jar_distributions=['substratevm:JUNIT_SUPPORT', 'mx:JUNIT_TOOL', 'mx:JUNIT', 'mx:HAMCREST'],
support_distributions=['substratevm:NATIVE_IMAGE_JUNITCP_SUPPORT'],
jlink=False,
))

libgraal_jar_distributions = [
'sdk:NATIVEBRIDGE',
'sdk:JNIUTILS',
Expand Down
9 changes: 0 additions & 9 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2327,15 +2327,6 @@
},
},

"NATIVE_IMAGE_JUNITCP_SUPPORT" : {
"native" : True,
"description" : "Native-image based junit testing support but with running image-builder on classpath",
"layout" : {
"native-image.properties" : "file:mx.substratevm/macro-junitcp.properties",
"svm-junit.packages" : "file:mx.substratevm/svm-junit.packages",
},
},

"SVM_FOREIGN": {
"subDir": "src",
"description" : "SubstrateVM support for the Foreign API",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ final class InternalResourceCache {

/**
* Recomputed before the analyses by a substitution in the {@code TruffleBaseFeature} based on
* the {@code CopyLanguageResources} option value. The field must not be declared as
* {@code final} to make the substitution function correctly.
* the {@code CopyLanguageResources} option value. The field must not qualify as a Java language
* constant (as defined in JLS 15.28) to prevent the Java compiler from inlining its value.
*/
private static boolean useInternalResources = true;
private static final boolean useInternalResources = Boolean.TRUE.booleanValue();
private static boolean useExternalDirectoryInNativeImage = true;

private final String id;
Expand Down Expand Up @@ -292,8 +292,9 @@ private static String sanitize(String pathElement) {
}

/**
* Returns true if internal resources are enabled. Internal resources can be disabled in the
* native image using {-H:-CopyLanguageResources} option.
* Returns true if internal resources are enabled. Internal resources are disabled in the native
* image when both the copying and inclusion of language resources are turned off. This can be
* achieved by using the {@code -H:-IncludeLanguageResources} option.
*/
public static boolean usesInternalResources() {
return useInternalResources;
Expand Down
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,dis,gvm,icu4j,ins,insight,insightheap,lg,llp,lsp,nfi-libffi,ni,nic,nil,nju,njucp,pro,rgx,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json
COMPONENTS=cmp,cov,dap,dis,gvm,icu4j,ins,insight,insightheap,lg,llp,lsp,nfi-libffi,ni,nic,nil,nju,pro,rgx,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=llp
4 changes: 2 additions & 2 deletions vm/mx.vm/mx_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ def local_path_to_url(args):
mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'sllvmvm', 'bnative-image', 'cmp', 'lg', 'llrc', 'llrl', 'llrlf', 'llrn', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pbi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file='polybench-sulong-ce')

if mx.get_os() == 'windows':
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False)
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'nic', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False)
else:
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svml', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False)
mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'nic', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svml', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False)
# pylint: enable=line-too-long


Expand Down

0 comments on commit 90d556e

Please sign in to comment.