diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2025-03-25 02:23:42 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-04-30 00:14:44 +0300 |
commit | 8e564f16aea388834b69e784a82b248bae825c66 (patch) | |
tree | 3da6f759e928e5265ba9bb563359c144b686572c /mesonbuild/compilers/rust.py | |
parent | 8909a09d2a8713c4fc0c31c2df6c9b022b840213 (diff) | |
download | meson-8e564f16aea388834b69e784a82b248bae825c66.zip meson-8e564f16aea388834b69e784a82b248bae825c66.tar.gz meson-8e564f16aea388834b69e784a82b248bae825c66.tar.bz2 |
compilers: introduce common helper for sanity checks
Avoid reinventing the wheel and instead use a single helper, taking care
of logging and cross compilation.
Fixes: #14373
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r-- | mesonbuild/compilers/rust.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index d0d2e69..cc9dc21 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -5,7 +5,7 @@ from __future__ import annotations import functools -import subprocess, os.path +import os.path import textwrap import re import typing as T @@ -141,17 +141,7 @@ class RustCompiler(Compiler): if pc.returncode != 0: raise EnvironmentException(f'Rust compiler {self.name_string()} cannot compile programs.') self._native_static_libs(work_dir, source_name) - if self.is_cross: - if not environment.has_exe_wrapper(): - # Can't check if the binaries run so we have to assume they do - return - cmdlist = environment.exe_wrapper.get_command() + [output_name] - else: - cmdlist = [output_name] - pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - pe.wait() - if pe.returncode != 0: - raise EnvironmentException(f'Executables created by Rust compiler {self.name_string()} are not runnable.') + self.run_sanity_check(environment, [output_name], work_dir) def _native_static_libs(self, work_dir: str, source_name: str) -> None: # Get libraries needed to link with a Rust staticlib |