@@ -462,10 +462,10 @@ class TruffleGateTags:
462
462
dsl_max_state_bit_test = ['dsl-max-state-bit-test' , 'fulltest' ]
463
463
parser_test = ['parser-test' , 'test' , 'fulltest' ]
464
464
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' ]
469
469
truffle_native_libcmusl_static = ['truffle-native-libcmusl-static' ]
470
470
truffle_native_libcmusl_static_quickbuild = ['truffle-native-libcmusl-static-quickbuild' ]
471
471
@@ -521,18 +521,8 @@ def gate_truffle_jvm(tasks):
521
521
sl_jvm_gate_tests (additional_jvm_args )
522
522
523
523
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
-
534
524
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
536
526
name_suffix = ' with quickbuild' if quickbuild else ''
537
527
538
528
with Task ('Truffle SL Native Fallback' + name_suffix , tasks , tags = tag ) as t :
@@ -543,29 +533,13 @@ def gate_truffle_native(tasks, quickbuild=False):
543
533
if t :
544
534
sl_native_optimized_gate_tests (quickbuild )
545
535
536
+ tag = TruffleGateTags .unittest_native_quickbuild if quickbuild else TruffleGateTags .unittest_native
546
537
with Task ('Truffle API Native Tests' + name_suffix , tasks , tags = tag ) as t :
547
538
if t :
548
539
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
- ])
556
540
truffle_native_unit_tests_gate (True , quickbuild )
557
541
truffle_native_unit_tests_gate (False , quickbuild )
558
542
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
-
569
543
tag = TruffleGateTags .truffle_native_libcmusl_static_quickbuild if quickbuild else TruffleGateTags .truffle_native_libcmusl_static
570
544
with Task ('Truffle API Native Tests with static libc musl' + name_suffix , tasks , tags = tag ) as t :
571
545
if t :
@@ -751,7 +725,15 @@ def _allow_runtime_reflection(for_types):
751
725
'-cp' , tmp ,
752
726
'--features=org.graalvm.junit.platform.JUnitPlatformFeature' ,
753
727
'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 )
755
737
756
738
# 4. Execute native unittests
757
739
test_results = os .path .join (tmp , 'test-results-native' , 'test' )
@@ -966,12 +948,11 @@ def _run_sl_tests(create_command):
966
948
base_name = os .path .splitext (f )[0 ]
967
949
test_file = join (test_path , base_name + '.sl' )
968
950
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
+
975
956
diff = compare_files (expected_file , temp .name )
976
957
if diff :
977
958
mx .log ("Failed command: {}" .format (" " .join (command )))
0 commit comments