Skip to content

Fix intrinsic-test for debug test suites #1771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ run() {
--env NORUN \
--env RUSTFLAGS \
--env STDARCH_TEST_NORUN \
--env PROFILE \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this line the debug CI wasn't actually doing anything different to the release CI and it turns out quite a few platforms are broken in debug mode. Will keep digging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some handwritten arm intrinsics that have not been fixed by #1503, e.g.

int64x1_t::splat(N as i64),

The wasm failure is due a hardcoded path to target/release. Not sure about freebsd, haven't looked into it yet.

--volume "${HOME}/.cargo":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
Expand Down
10 changes: 6 additions & 4 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,26 @@ esac
case "${TARGET}" in
aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*)
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
--runner "${TEST_RUNNER}" \
--cppcompiler "${TEST_CXX_COMPILER}" \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}"
--target "${TARGET}" \
"${PROFILE}"
;;

aarch64_be-unknown-linux-gnu*)
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
--runner "${TEST_RUNNER}" \
--cppcompiler "${TEST_CXX_COMPILER}" \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}" \
--linker "${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER}" \
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}"
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}" \
"${PROFILE}"
;;
*)
;;
Expand Down
57 changes: 26 additions & 31 deletions crates/intrinsic-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ fn build_rust(
toolchain: Option<&str>,
target: &str,
linker: Option<&str>,
profile: &str,
) -> bool {
intrinsics.iter().for_each(|i| {
let rust_dir = format!(r#"rust_programs/{}"#, i.name);
Expand Down Expand Up @@ -413,11 +414,7 @@ path = "{intrinsic}/main.rs""#,
/* If there has been a linker explicitly set from the command line then
* we want to set it via setting it in the RUSTFLAGS*/

let cargo_command = format!(
"cargo {toolchain} build --target {target} --release",
toolchain = toolchain,
target = target
);
let cargo_command = format!("cargo {toolchain} build --target {target} --profile={profile}");

let mut command = Command::new("sh");
command
Expand Down Expand Up @@ -495,6 +492,10 @@ struct Cli {
/// Set the sysroot for the C++ compiler
#[arg(long)]
cxx_toolchain_dir: Option<String>,

/// Set the profile to build Rust code under
#[arg(long, default_value_t = String::from("dev"))]
profile: String,
}

fn main() {
Expand All @@ -507,6 +508,7 @@ fn main() {
let target: &str = args.target.as_str();
let linker = args.linker.as_deref();
let cxx_toolchain_dir = args.cxx_toolchain_dir;
let profile = args.profile;

let skip = if let Some(filename) = args.skip {
let data = std::fs::read_to_string(&filename).expect("Failed to open file");
Expand Down Expand Up @@ -559,12 +561,19 @@ fn main() {
std::process::exit(2);
}

if !build_rust(&notices, &intrinsics, toolchain.as_deref(), target, linker) {
if !build_rust(
&notices,
&intrinsics,
toolchain.as_deref(),
target,
linker,
&profile,
) {
std::process::exit(3);
}

if let Some(ref toolchain) = toolchain {
if !compare_outputs(&intrinsics, toolchain, &c_runner, target) {
if !compare_outputs(&intrinsics, toolchain, &c_runner, target, &profile) {
std::process::exit(1)
}
}
Expand All @@ -581,6 +590,7 @@ fn compare_outputs(
toolchain: &str,
runner: &str,
target: &str,
profile: &str,
) -> bool {
let intrinsics = intrinsics
.par_iter()
Expand All @@ -589,34 +599,19 @@ fn compare_outputs(
.arg("-c")
.arg(format!(
"{runner} ./c_programs/{intrinsic}",
runner = runner,
intrinsic = intrinsic.name,
))
.output();

let rust = if target != "aarch64_be-unknown-linux-gnu" {
Command::new("sh")
.current_dir("rust_programs")
.arg("-c")
.arg(format!(
"cargo {toolchain} run --target {target} --bin {intrinsic} --release",
intrinsic = intrinsic.name,
toolchain = toolchain,
target = target
))
.env("RUSTFLAGS", "-Cdebuginfo=0")
.output()
} else {
Command::new("sh")
.arg("-c")
.arg(format!(
"{runner} ./rust_programs/target/{target}/release/{intrinsic}",
runner = runner,
target = target,
intrinsic = intrinsic.name,
))
.output()
};
let rust = Command::new("sh")
.current_dir("rust_programs")
.arg("-c")
.arg(format!(
"cargo {toolchain} run --target {target} --bin {intrinsic} --profile={profile}",
intrinsic = intrinsic.name,
))
.env("RUSTFLAGS", "-Cdebuginfo=0")
.output();

let (c, rust) = match (c, rust) {
(Ok(c), Ok(rust)) => (c, rust),
Expand Down
Loading