tests/run-make: update mte-ffi to use gcc as the c compiler explicitly

This commit is contained in:
Jieyou Xu 2024-11-10 16:10:17 +08:00
parent 98c771c187
commit a6dac708f5
2 changed files with 11 additions and 17 deletions

View File

@ -1,7 +1,6 @@
use std::path::Path;
use crate::command::Command;
use crate::env_var;
/// Construct a gcc invocation.
///
@ -23,15 +22,11 @@ crate::macros::impl_common_helpers!(Gcc);
impl Gcc {
/// Construct a `gcc` invocation. This assumes that *a* suitable `gcc` is available in the
/// environment.
///
/// Note that this does **not** prepopulate the `gcc` invocation with `CC_DEFAULT_FLAGS`.
#[track_caller]
pub fn new() -> Self {
let mut cmd = Command::new("gcc");
let default_cflags = env_var("CC_DEFAULT_FLAGS");
for flag in default_cflags.split(char::is_whitespace) {
cmd.arg(flag);
}
let cmd = Command::new("gcc");
Self { cmd }
}

View File

@ -1,14 +1,12 @@
// Tests that MTE tags and values stored in the top byte of a pointer (TBI) are
// preserved across FFI boundaries (C <-> Rust).
// This test does not require MTE: whilst the test will use MTE if available, if it is not,
// arbitrary tag bits are set using TBI.
//! Tests that MTE tags and values stored in the top byte of a pointer (TBI) are preserved across
//! FFI boundaries (C <-> Rust). This test does not require MTE: whilst the test will use MTE if
//! available, if it is not, arbitrary tag bits are set using TBI.
// This test is only valid for AArch64.
// The linker must be explicitly specified when cross-compiling, so it is limited to
// `aarch64-unknown-linux-gnu`.
//@ only-aarch64-unknown-linux-gnu
// Reason: this test is only valid for AArch64 with `gcc`. The linker must be explicitly specified
// when cross-compiling, so it is limited to `aarch64-unknown-linux-gnu`.
use run_make_support::{cc, dynamic_lib_name, extra_c_flags, run, rustc, target};
use run_make_support::{dynamic_lib_name, extra_c_flags, gcc, run, rustc, target};
fn main() {
run_test("int");
@ -29,7 +27,8 @@ fn run_test(variant: &str) {
.target(target())
.linker("aarch64-linux-gnu-gcc")
.run();
cc().input(format!("bar_{variant}.c"))
gcc()
.input(format!("bar_{variant}.c"))
.input(dynamic_lib_name("foo"))
.out_exe("test")
.args(&flags)