Skip to content

Commit f88cf6e

Browse files
committed
Fixed windows build.
1 parent 7aff7ed commit f88cf6e

File tree

3 files changed

+38
-44
lines changed

3 files changed

+38
-44
lines changed

sdk/mx.sdk/mx_sdk_vm_impl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3042,7 +3042,7 @@ def _get_jvm_cfg():
30423042
def _get_jvm_cfg_contents(cfgs_to_add):
30433043

30443044
def validate_cfg_line(line, source):
3045-
if line.startswith('#'):
3045+
if line.startswith('#') or len(line.strip()) == 0:
30463046
return
30473047
if not line.startswith('-'):
30483048
raise mx.abort("Invalid line in {}:\n{}".format(source, line))

truffle/ci/ci.jsonnet

+17-4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@
112112
name: 'gate-truffle-ce-jvm-' + self.jdk_name + '-linux-amd64',
113113
},
114114

115+
# runs only truffle native unittests
116+
local truffle_native_unittest_gate = truffle_common + {
117+
gate_tag_suffix: '',
118+
run+: [
119+
['mx', '--no-jlinking', 'gate', '--no-warning-as-error', '--tags', 'build,unittest-native' + self.gate_tag_suffix],
120+
],
121+
notify_groups: ["truffle"],
122+
components+: ["truffle"],
123+
timelimit: '1:00:00',
124+
name: 'gate-truffle-ce-native-unittest' + self.gate_tag_suffix + '-jvm-' + self.jdk_name + '-' + self.os + '-' + self.arch,
125+
},
126+
127+
# runs native SL tests and truffle native unittests
115128
local truffle_native_gate = truffle_common + {
116129
gate_tag_suffix: '',
117130
run+: [
@@ -153,16 +166,16 @@
153166
linux_amd64 + common.oraclejdk23 + truffle_jvm_gate,
154167
linux_amd64 + graalVMCELatest + truffle_jvm_gate,
155168
# Truffle Native gate
156-
linux_amd64 + common.graalvmee21 + truffle_native_gate,
157-
linux_amd64 + common.graalvmee21 + truffle_native_gate + {
169+
linux_amd64 + common.graalvmee21 + truffle_native_gate,
170+
linux_amd64 + common.graalvmee21 + truffle_native_gate + {
158171
gate_tag_suffix: '-quickbuild'
159172
},
160173
linux_amd64 + graalVMCELatest + truffle_native_gate,
161-
windows_amd64 + graalVMCELatest + devkits["windows-jdkLatest"] + truffle_native_gate,
174+
windows_amd64 + graalVMCELatest + devkits["windows-jdkLatest"] + truffle_native_unittest_gate,
162175
linux_amd64 + graalVMCELatest + truffle_native_gate + {
163176
gate_tag_suffix: '-quickbuild'
164177
},
165-
windows_amd64 + graalVMCELatest + devkits["windows-jdkLatest"] + truffle_native_gate + {
178+
windows_amd64 + graalVMCELatest + devkits["windows-jdkLatest"] + truffle_native_unittest_gate + {
166179
gate_tag_suffix: '-quickbuild'
167180
},
168181

truffle/mx.truffle/mx_truffle.py

+20-39
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ class TruffleGateTags:
462462
dsl_max_state_bit_test = ['dsl-max-state-bit-test', 'fulltest']
463463
parser_test = ['parser-test', 'test', 'fulltest']
464464
truffle_jvm = ['truffle-jvm']
465-
truffle_native = ['truffle-native']
466-
truffle_native_quickbuild = ['truffle-native-quickbuild']
467-
truffle_native_memory_fencing = ['truffle-native-memory-fencing']
468-
truffle_native_memory_fencing_quickbuild = ['truffle-native-memory-fencing-quickbuild']
465+
sl_native = ['sl-native', 'truffle-native']
466+
sl_native_quickbuild = ['sl-native-quickbuild', 'truffle-native-quickbuild']
467+
unittest_native = ['unittest-native', 'truffle-native']
468+
unittest_native_quickbuild = ['unittest-native-quickbuild', 'truffle-native-quickbuild']
469469
truffle_native_libcmusl_static = ['truffle-native-libcmusl-static']
470470
truffle_native_libcmusl_static_quickbuild = ['truffle-native-libcmusl-static-quickbuild']
471471

@@ -521,18 +521,8 @@ def gate_truffle_jvm(tasks):
521521
sl_jvm_gate_tests(additional_jvm_args)
522522

523523

524-
def _native_image_supports_option(option):
525-
native_image = _native_image(mx.get_jdk(tag='graalvm'))
526-
out = mx.LinesOutputCapture()
527-
mx.run([native_image, '--expert-options-all'], out=out)
528-
for line in out.lines:
529-
if option in line:
530-
return True
531-
return False
532-
533-
534524
def gate_truffle_native(tasks, quickbuild=False):
535-
tag = TruffleGateTags.truffle_native_quickbuild if quickbuild else TruffleGateTags.truffle_native
525+
tag = TruffleGateTags.sl_native_quickbuild if quickbuild else TruffleGateTags.sl_native
536526
name_suffix = ' with quickbuild' if quickbuild else ''
537527

538528
with Task('Truffle SL Native Fallback' + name_suffix, tasks, tags=tag) as t:
@@ -543,29 +533,13 @@ def gate_truffle_native(tasks, quickbuild=False):
543533
if t:
544534
sl_native_optimized_gate_tests(quickbuild)
545535

536+
tag = TruffleGateTags.unittest_native_quickbuild if quickbuild else TruffleGateTags.unittest_native
546537
with Task('Truffle API Native Tests' + name_suffix, tasks, tags=tag) as t:
547538
if t:
548539
truffle_native_context_preinitialization_tests(quickbuild)
549-
# Test that the static object model can deal with non-long aligned byte array base offsets (GR-43403)
550-
if _native_image_supports_option('OptionalIdentityHashCodes'):
551-
truffle_native_context_preinitialization_tests(quickbuild, [
552-
'-H:+UnlockExperimentalVMOptions',
553-
'-H:-OptionalIdentityHashCodes',
554-
'-H:-UnlockExperimentalVMOptions'
555-
])
556540
truffle_native_unit_tests_gate(True, quickbuild)
557541
truffle_native_unit_tests_gate(False, quickbuild)
558542

559-
tag = TruffleGateTags.truffle_native_memory_fencing_quickbuild if quickbuild else TruffleGateTags.truffle_native_memory_fencing
560-
with Task('Truffle API Native Tests with MemoryMaskingAndFencing mitigation' + name_suffix, tasks, tags=tag) as t:
561-
if t:
562-
if _native_image_supports_option('MemoryMaskingAndFencing'):
563-
truffle_native_unit_tests_gate(True, False, [
564-
'-H:+UnlockExperimentalVMOptions',
565-
'-R:+MemoryMaskingAndFencing',
566-
'-H:-UnlockExperimentalVMOptions'
567-
])
568-
569543
tag = TruffleGateTags.truffle_native_libcmusl_static_quickbuild if quickbuild else TruffleGateTags.truffle_native_libcmusl_static
570544
with Task('Truffle API Native Tests with static libc musl' + name_suffix, tasks, tags=tag) as t:
571545
if t:
@@ -751,7 +725,15 @@ def _allow_runtime_reflection(for_types):
751725
'-cp', tmp,
752726
'--features=org.graalvm.junit.platform.JUnitPlatformFeature',
753727
'org.graalvm.junit.platform.NativeImageJUnitLauncher']
754-
mx.run([native_image] + vm_args + native_image_args)
728+
729+
# Use an argument file to avoid exceeding the command-line length limit on Windows
730+
with tempfile.NamedTemporaryFile(mode='w', delete=False) as args_file:
731+
for arg in vm_args + native_image_args:
732+
args_file.write(arg)
733+
args_file.write(os.linesep)
734+
mx.run([native_image, '@' + args_file.name])
735+
# delete file only on success
736+
os.unlink(args_file.name)
755737

756738
# 4. Execute native unittests
757739
test_results = os.path.join(tmp, 'test-results-native', 'test')
@@ -966,12 +948,11 @@ def _run_sl_tests(create_command):
966948
base_name = os.path.splitext(f)[0]
967949
test_file = join(test_path, base_name + '.sl')
968950
expected_file = join(test_path, base_name + '.output')
969-
temp = tempfile.NamedTemporaryFile(delete=False)
970-
command = create_command(test_file)
971-
mx.log("Running SL test {}".format(test_file))
972-
with open(temp.name, 'w') as out:
973-
mx.run(command, nonZeroIsFatal=False, out=out, err=out)
974-
out.flush()
951+
with tempfile.NamedTemporaryFile(delete=False) as temp:
952+
command = create_command(test_file)
953+
mx.log("Running SL test {}".format(test_file))
954+
mx.run(command, nonZeroIsFatal=False, out=temp, err=temp)
955+
975956
diff = compare_files(expected_file, temp.name)
976957
if diff:
977958
mx.log("Failed command: {}".format(" ".join(command)))

0 commit comments

Comments
 (0)