diff --git a/tests/utils/stl/compiler.py b/tests/utils/stl/compiler.py index 6a638046938..ff5d4ef3bdd 100644 --- a/tests/utils/stl/compiler.py +++ b/tests/utils/stl/compiler.py @@ -22,7 +22,7 @@ class CXXCompiler: CM_Analyze = 4 def __init__(self, path, flags=None, compile_flags=None, - link_flags=None, compile_env=None): + link_flags=None, compile_env=None, edg_drop=None): self.path = path if path is not None: self.name = os.path.basename(path).split('.')[0] @@ -34,6 +34,7 @@ def __init__(self, path, flags=None, compile_flags=None, self.link_flags = link_flags or [] self.compile_env = compile_env + self.edg_drop = edg_drop def _basicCmd(self, source_files: List[Path], out: Path, mode=CM_Default, flags=[], compile_flags=[], link_flags=[], diff --git a/tests/utils/stl/test/config.py b/tests/utils/stl/test/config.py index d9a6c040352..e8f1fd773c4 100644 --- a/tests/utils/stl/test/config.py +++ b/tests/utils/stl/test/config.py @@ -298,6 +298,10 @@ def configure_default_compiler(self): self.default_compiler.compile_env = self.config.environment + env_var = 'STL_EDG_DROP' + if env_var in os.environ and os.environ[env_var] is not None: + self.default_compiler.edg_drop = os.environ[env_var] + # TRANSITION: Investigate using SSHExecutor for ARM def configure_executors(self): self.build_executor = LocalExecutor() diff --git a/tests/utils/stl/test/format.py b/tests/utils/stl/test/format.py index 8132ba29b3f..d82a1fa9180 100644 --- a/tests/utils/stl/test/format.py +++ b/tests/utils/stl/test/format.py @@ -244,14 +244,44 @@ def getBuildSteps(self, test, lit_config, shared): output_dir = test.getOutputDir() source_path = Path(test.getSourcePath()) + flags = [] + isense_rsp_path = None + if test.cxx.edg_drop is not None: + isense_rsp_path = output_dir / (output_base + '.isense.rsp') + flags.extend(['/dE--write-isense-rsp', '/dE' + str(isense_rsp_path)]) + cmd, out_files, shared.exec_file = \ test.cxx.executeBasedOnFlagsCmd([source_path], output_dir, shared.exec_dir, output_base, - [], [], []) + flags, [], []) yield TestStep(cmd, shared.exec_dir, [source_path], test.cxx.compile_env) + if isense_rsp_path is not None: + with open(isense_rsp_path) as f: + cmd = [line.strip() for line in f] + cmd[0] = test.cxx.edg_drop + + # cpfecl translates /Fo into --import_dir, but that is not + # used in the same way by upstream EDG. + try: + index = cmd.index('--import_dir') + cmd.pop(index) + cmd.pop(index) + except ValueError: + pass + + # --print_diagnostics is not recognized by upstream EDG. + try: + index = cmd.index('--print_diagnostics') + cmd.pop(index) + except ValueError: + pass + + yield TestStep(cmd, shared.exec_dir, [source_path], + test.cxx.compile_env) + def getTestSteps(self, test, lit_config, shared): if shared.exec_file is not None: exec_env = test.cxx.compile_env diff --git a/tests/utils/stl/test/tests.py b/tests/utils/stl/test/tests.py index 6728132870a..0dce11f5afe 100644 --- a/tests/utils/stl/test/tests.py +++ b/tests/utils/stl/test/tests.py @@ -34,6 +34,7 @@ def __init__(self, suite, path_in_suite, lit_config, test_config, self._configure_cxx(lit_config, envlst_entry, default_cxx) + use_edg = False for flag in chain(self.cxx.flags, self.cxx.compile_flags): if flag[1:] == 'clr:pure': self.requires.append('clr_pure') # TRANSITION, GH-798 @@ -41,6 +42,10 @@ def __init__(self, suite, path_in_suite, lit_config, test_config, self.requires.append('clr') # TRANSITION, GH-797 elif flag[1:] == 'BE': self.requires.append('edg') # available for x86, see config.py + use_edg = True + + if not use_edg and self.cxx.edg_drop is not None: + self.skipped = True def getOutputDir(self): return Path(os.path.join( @@ -142,7 +147,7 @@ def _configure_cxx(self, lit_config, envlst_entry, default_cxx): compile_flags.append('-m32') self.cxx = CXXCompiler(cxx, flags, compile_flags, link_flags, - default_cxx.compile_env) + default_cxx.compile_env, default_cxx.edg_drop) # This is partially lifted from lit's Test class. The changes here are to # handle skipped tests, our env.lst format, and different naming schemes.