Skip to content

Commit

Permalink
test(specified_target): add with_{env_var,flag}_aarch64_unknown_none
Browse files Browse the repository at this point in the history
Both testcases require `rustup target add x86_64-unknown-linux-gnu`.

But currently, cargo has a bug for learning target info:

command=`CARGO_BUILD_TARGET="aarch64-unknown-none" "/home/zjp/rust/cargo-semver-checks/target/debug/cargo-semver-checks" "semver-checks" "check-release" "--manifest-path=t
est_crates/template/new" "--baseline-root=test_crates/template/old"`
code=1
stdout=""
stderr=```
    Building template v0.1.0 (current)
error: running cargo-doc on crate \'template\' failed with output:
-----
error: output of --print=file-names missing when learning about target-specific information from rustc
command was: `/home/zjp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names --cap-lints=allow --target aarch64-unknown-none
 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=c
rate-name --print=cfg`

--- stdout
___
lib___.rlib
lib___.a
/home/zjp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
off
___
debug_assertions
fmt_debug=\"full\"
overflow_checks
panic=\"abort\"
proc_macro
relocation_model=\"static\"
target_abi=\"\"
target_arch=\"aarch64\"
target_endian=\"little\"
target_env=\"\"
target_feature=\"neon\"
target_has_atomic
target_has_atomic=\"128\"
target_has_atomic=\"16\"
target_has_atomic=\"32\"
target_has_atomic=\"64\"
target_has_atomic=\"8\"
target_has_atomic=\"ptr\"
target_has_atomic_equal_alignment=\"128\"
target_has_atomic_equal_alignment=\"16\"
target_has_atomic_equal_alignment=\"32\"
target_has_atomic_equal_alignment=\"64\"
target_has_atomic_equal_alignment=\"8\"
target_has_atomic_equal_alignment=\"ptr\"
target_has_atomic_load_store
target_has_atomic_load_store=\"128\"
target_has_atomic_load_store=\"16\"
target_has_atomic_load_store=\"32\"
target_has_atomic_load_store=\"64\"
target_has_atomic_load_store=\"8\"
target_has_atomic_load_store=\"ptr\"
target_os=\"none\"
target_pointer_width=\"64\"
target_vendor=\"unknown\"
ub_checks

Hopefully, the fix from cargo will land in weekend.
Ref #1068 (comment)
  • Loading branch information
zjp-CN committed Jan 10, 2025
1 parent a603731 commit 2ee470d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/specified_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ fn with_env_var_riscv64gc_unknown_linux_gnu() {
.success();
}

#[test]
fn with_env_var_aarch64_unknown_none() {
base()
.env("CARGO_BUILD_TARGET", "aarch64-unknown-none")
.assert()
.success();
}

#[test]
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
fn with_flag() {
Expand All @@ -51,3 +59,12 @@ fn with_flag_riscv64gc_unknown_linux_gnu() {
.assert()
.success();
}

#[test]
fn with_flag_aarch64_unknown_none() {
base()
.env_remove("CARGO_BUILD_TARGET")
.arg("--target=aarch64-unknown-none")
.assert()
.success();
}

0 comments on commit 2ee470d

Please sign in to comment.