|
|
|
@ -9,7 +9,6 @@ import subprocess |
|
|
|
|
import typing as T |
|
|
|
|
|
|
|
|
|
from .. import mesonlib |
|
|
|
|
from .. import mlog |
|
|
|
|
from ..arglist import CompilerArgs |
|
|
|
|
from ..linkers import RSPFileSyntax |
|
|
|
|
from ..mesonlib import ( |
|
|
|
@ -571,32 +570,11 @@ class DCompiler(Compiler): |
|
|
|
|
args.append(extra_args) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def run(self, code: 'mesonlib.FileOrString', env: 'Environment', *, |
|
|
|
|
def run(self, code: 'mesonlib.FileOrString', env: 'Environment', |
|
|
|
|
extra_args: T.Union[T.List[str], T.Callable[[CompileCheckMode], T.List[str]], None] = None, |
|
|
|
|
dependencies: T.Optional[T.List['Dependency']] = None) -> compilers.RunResult: |
|
|
|
|
need_exe_wrapper = env.need_exe_wrapper(self.for_machine) |
|
|
|
|
if need_exe_wrapper and self.exe_wrapper is None: |
|
|
|
|
raise compilers.CrossNoRunException('Can not run test applications in this cross environment.') |
|
|
|
|
extra_args = self._get_compile_extra_args(extra_args) |
|
|
|
|
with self._build_wrapper(code, env, extra_args, dependencies, mode=CompileCheckMode.LINK, want_output=True) as p: |
|
|
|
|
if p.returncode != 0: |
|
|
|
|
mlog.debug(f'Could not compile test file {p.input_name}: {p.returncode}\n') |
|
|
|
|
return compilers.RunResult(False) |
|
|
|
|
if need_exe_wrapper: |
|
|
|
|
cmdlist = self.exe_wrapper.get_command() + [p.output_name] |
|
|
|
|
else: |
|
|
|
|
cmdlist = [p.output_name] |
|
|
|
|
try: |
|
|
|
|
pe, so, se = mesonlib.Popen_safe(cmdlist) |
|
|
|
|
except Exception as e: |
|
|
|
|
mlog.debug(f'Could not run: {cmdlist} (error: {e})\n') |
|
|
|
|
return compilers.RunResult(False) |
|
|
|
|
|
|
|
|
|
mlog.debug('Program stdout:\n') |
|
|
|
|
mlog.debug(so) |
|
|
|
|
mlog.debug('Program stderr:\n') |
|
|
|
|
mlog.debug(se) |
|
|
|
|
return compilers.RunResult(True, pe.returncode, so, se) |
|
|
|
|
return super().run(code, env, extra_args, dependencies) |
|
|
|
|
|
|
|
|
|
def sizeof(self, typename: str, prefix: str, env: 'Environment', *, |
|
|
|
|
extra_args: T.Union[None, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]] = None, |
|
|
|
|