@@ -523,22 +523,33 @@ def check_incr_transfer_roundtrip_exec() -> None:
523523 )
524524
525525
526- def find_lit_test_helper_exec (
527- toolchain : str , build_dir : Optional [str ], release : bool
526+ def find_swiftpm_bin_path (
527+ package_dir : str , toolchain : str , build_dir : Optional [str ], release : bool
528528) -> str :
529529 swiftpm_call = get_swiftpm_invocation (
530530 toolchain = toolchain ,
531531 action = "build" ,
532- package_dir = PACKAGE_DIR ,
532+ package_dir = package_dir ,
533533 build_dir = build_dir ,
534534 multiroot_data_file = None ,
535535 release = release ,
536536 )
537- swiftpm_call .extend (["--product" , "lit-test-helper" ])
538537 swiftpm_call .extend (["--show-bin-path" ])
539538
540539 bin_dir = subprocess .check_output (swiftpm_call )
541- return os .path .join (bin_dir .strip ().decode ('utf-8' ), "lit-test-helper" )
540+ return bin_dir .strip ().decode ('utf-8' )
541+
542+
543+ def find_product_bin_path (
544+ toolchain : str , build_dir : Optional [str ], release : bool
545+ ) -> str :
546+ return find_swiftpm_bin_path (PACKAGE_DIR , toolchain , build_dir , release )
547+
548+
549+ def find_examples_bin_path (
550+ toolchain : str , build_dir : Optional [str ], release : bool
551+ ) -> str :
552+ return find_swiftpm_bin_path (EXAMPLES_DIR , toolchain , build_dir , release )
542553
543554
544555def run_lit_tests (toolchain : str , build_dir : Optional [str ], release : bool ,
@@ -548,9 +559,12 @@ def run_lit_tests(toolchain: str, build_dir: Optional[str], release: bool,
548559 check_lit_exec ()
549560 check_incr_transfer_roundtrip_exec ()
550561
551- lit_test_helper_exec = find_lit_test_helper_exec (
552- toolchain = toolchain , build_dir = build_dir , release = release
553- )
562+ product_bin_path = find_product_bin_path (
563+ toolchain = toolchain , build_dir = build_dir , release = release )
564+ examples_bin_path = find_examples_bin_path (
565+ toolchain = toolchain , build_dir = build_dir , release = release )
566+
567+ lit_test_helper_exec = os .path .join (product_bin_path , "lit-test-helper" )
554568
555569 lit_call = ["python3" , LIT_EXEC ]
556570 lit_call .append (os .path .join (PACKAGE_DIR , "lit_tests" ))
@@ -562,11 +576,7 @@ def run_lit_tests(toolchain: str, build_dir: Optional[str], release: bool,
562576 lit_call .extend (
563577 ["--param" , "INCR_TRANSFER_ROUND_TRIP.PY=" + INCR_TRANSFER_ROUNDTRIP_EXEC ]
564578 )
565-
566- build_subdir = 'release' if release else 'debug'
567- package_build_dir = build_dir + '/' + build_subdir
568-
569- lit_call .extend (["--param" , "BUILD_DIR=" + package_build_dir ])
579+ lit_call .extend (["--param" , "EXAMPLES_BIN_PATH=" + examples_bin_path ])
570580 lit_call .extend (["--param" , "TOOLCHAIN=" + toolchain ])
571581
572582 # Print all failures
@@ -662,7 +672,7 @@ def verify_source_code_command(args: argparse.Namespace) -> None:
662672def build_command (args : argparse .Namespace ) -> None :
663673 try :
664674 builder = Builder (
665- toolchain = args .toolchain ,
675+ toolchain = realpath ( args .toolchain ) ,
666676 build_dir = realpath (args .build_dir ),
667677 multiroot_data_file = args .multiroot_data_file ,
668678 release = args .release ,
@@ -685,7 +695,7 @@ def build_command(args: argparse.Namespace) -> None:
685695def test_command (args : argparse .Namespace ) -> None :
686696 try :
687697 builder = Builder (
688- toolchain = args .toolchain ,
698+ toolchain = realpath ( args .toolchain ) ,
689699 build_dir = realpath (args .build_dir ),
690700 multiroot_data_file = args .multiroot_data_file ,
691701 release = args .release ,
@@ -697,7 +707,7 @@ def test_command(args: argparse.Namespace) -> None:
697707 builder .buildExample ("ExamplePlugin" )
698708
699709 run_tests (
700- toolchain = args .toolchain ,
710+ toolchain = realpath ( args .toolchain ) ,
701711 build_dir = realpath (args .build_dir ),
702712 multiroot_data_file = args .multiroot_data_file ,
703713 release = args .release ,
0 commit comments