@@ -573,6 +573,44 @@ config.target_runtime = "unknown"
573
573
574
574
swift_reflection_test_name = 'swift-reflection-test' + config .variant_suffix
575
575
576
+ def use_interpreter_for_simple_runs ():
577
+ def make_simple_target_run (gyb = False , stdlib = False , swift3 = False , opt = "" ):
578
+ result = ''
579
+ if gyb :
580
+ result += ('%empty-directory(%t) && '
581
+ '%gyb %s -o %t/main.swift && '
582
+ '%line-directive %t/main.swift -- ' )
583
+ # FIXME: SWIFT_INTERPRETER needs to be a set of arguments, not just a
584
+ # path.
585
+ result += (
586
+ 'env SWIFT_INTERPRETER=%r %s %r %s -module-name main %s %s %s '
587
+ % (config .swift , xcrun_prefix , config .swift , target_options ,
588
+ config .swift_test_options ,
589
+ config .swift_driver_test_options ,
590
+ swift_execution_tests_extra_flags ))
591
+ if stdlib :
592
+ result += '-Xfrontend -disable-access-control '
593
+ if swift3 :
594
+ result += '-swift-version 3 '
595
+ if opt :
596
+ result += opt + ' '
597
+ if gyb :
598
+ result += '%t/main.swift'
599
+ else :
600
+ result += '%s'
601
+ return result
602
+ config .target_run_stdlib_swiftgyb_swift3 = make_simple_target_run (gyb = True , stdlib = True , swift3 = True )
603
+ config .target_run_stdlib_swiftgyb = make_simple_target_run (gyb = True , swift3 = True )
604
+ config .target_run_simple_swiftgyb_swift3 = make_simple_target_run (gyb = True , swift3 = True )
605
+ config .target_run_simple_swiftgyb = make_simple_target_run (gyb = True )
606
+ config .target_run_stdlib_swift_swift3 = make_simple_target_run (stdlib = True , swift3 = True )
607
+ config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
608
+ config .target_run_simple_swift_swift3 = make_simple_target_run (swift3 = True )
609
+ config .target_run_simple_opt_Osize_swift = make_simple_target_run (opt = '-Osize' )
610
+ config .target_run_simple_opt_O_swift = make_simple_target_run (opt = '-O' )
611
+ config .target_run_simple_swift = make_simple_target_run ()
612
+ config .available_features .add ('interpret' )
613
+
576
614
if run_vendor == 'apple' :
577
615
config .available_features .add ('objc_interop' )
578
616
config .target_swiftmodule_name = run_cpu + ".swiftmodule"
@@ -702,30 +740,7 @@ if run_vendor == 'apple':
702
740
config .target_run = ""
703
741
704
742
if 'interpret' in lit_config .params :
705
- target_run_base = (
706
- '%s %s %s -module-name main %s %s %s'
707
- % (xcrun_prefix , config .swift , target_options ,
708
- config .swift_test_options ,
709
- config .swift_driver_test_options ,
710
- swift_execution_tests_extra_flags ))
711
- target_run_stdlib = (
712
- '%s -Xfrontend -disable-access-control' % (target_run_base ))
713
- config .target_run_simple_swift = (
714
- "%s %%s" % (target_run_base ))
715
- config .target_run_simple_swiftgyb = (
716
- '%%empty-directory(%%t) && '
717
- '%%gyb %%s -o %%t/main.swift && '
718
- '%%line-directive %%t/main.swift -- %s %%t/main.swift'
719
- % (target_run_base ))
720
- config .target_run_stdlib_swift = (
721
- "%s %%s" % (target_run_stdlib ))
722
- config .target_run_stdlib_swiftgyb = (
723
- '%%empty-directory(%%t) && '
724
- '%%gyb %%s -o %%t/main.swift && '
725
- '%%line-directive %%t/main.swift -- %s %%t/main.swift'
726
- % (target_run_stdlib ))
727
- config .available_features .add ('interpret' )
728
- config .environment ['SWIFT_INTERPRETER' ] = config .swift
743
+ use_interpreter_for_simple_runs ()
729
744
730
745
(sw_vers_name , sw_vers_vers , sw_vers_build ) = \
731
746
darwin_get_sw_vers ()
@@ -819,30 +834,7 @@ elif run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'windows-cygnus', 'wi
819
834
subst_target_swift_frontend_mock_sdk_after = ""
820
835
config .target_run = ''
821
836
if 'interpret' in lit_config .params :
822
- target_run_base = (
823
- '%s -target %s %s %s -module-name main %s %s %s'
824
- % (config .swift , config .variant_triple , resource_dir_opt ,
825
- mcp_opt , config .swift_test_options ,
826
- config .swift_driver_test_options ,
827
- swift_execution_tests_extra_flags ))
828
- target_run_stdlib = (
829
- '%s -Xfrontend -disable-access-control' % (target_run_base ))
830
- config .target_run_simple_swift = (
831
- '%s %%s' % (target_run_base ))
832
- config .target_run_simple_swiftgyb = (
833
- '%%empty-directory(%%t) && '
834
- '%%gyb %%s -o %%t/main.swift && '
835
- '%%line-directive %%t/main.swift -- %s %%t/main.swift'
836
- % (target_run_base ))
837
- config .target_run_stdlib_swift = (
838
- '%s %%s' % (target_run_stdlib ))
839
- config .target_run_stdlib_swiftgyb = (
840
- '%%empty-directory(%%t) && '
841
- '%%gyb %%s -o %%t/main.swift && '
842
- '%%line-directive %%t/main.swift -- %s %%t/main.swift'
843
- % (target_run_stdlib ))
844
- config .available_features .add ('interpret' )
845
- config .environment ['SWIFT_INTERPRETER' ] = config .swift
837
+ use_interpreter_for_simple_runs ()
846
838
config .target_sil_opt = (
847
839
'%s -target %s %s %s %s' %
848
840
(config .sil_opt , config .variant_triple , resource_dir_opt , mcp_opt , config .sil_test_options ))
0 commit comments