-
Notifications
You must be signed in to change notification settings - Fork 108
Add abi-checker to y.rs and run it on CI #1255
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3bd9821
Initial ABI Checker support
afonso360 fb6362e
Test adding abi-checker to CI
afonso360 5693122
Add abi-checker to clean_all.sh
afonso360 e5ba71a
Pass all pairs to abi-checker
afonso360 7610be4
Move abi-checker to y.rs test
afonso360 0706df5
Update abi-checker version
afonso360 69c6749
Disable some abi-checker tests
afonso360 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ perf.data.old | |
/regex | ||
/simple-raytracer | ||
/portable-simd | ||
/abi-checker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
use super::build_sysroot; | ||
use super::utils::spawn_and_wait_with_input; | ||
use build_system::SysrootKind; | ||
use std::env; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
pub(crate) fn run( | ||
channel: &str, | ||
sysroot_kind: SysrootKind, | ||
target_dir: &Path, | ||
cg_clif_build_dir: &Path, | ||
host_triple: &str, | ||
target_triple: &str, | ||
) { | ||
assert_eq!( | ||
host_triple, target_triple, | ||
"abi-checker not supported on cross-compilation scenarios" | ||
); | ||
|
||
eprintln!("Building sysroot for abi-checker"); | ||
build_sysroot::build_sysroot( | ||
channel, | ||
sysroot_kind, | ||
target_dir, | ||
cg_clif_build_dir, | ||
host_triple, | ||
target_triple, | ||
); | ||
|
||
eprintln!("Running abi-checker"); | ||
let mut abi_checker_path = env::current_dir().unwrap(); | ||
abi_checker_path.push("abi-checker"); | ||
env::set_current_dir(abi_checker_path.clone()).unwrap(); | ||
|
||
let build_dir = abi_checker_path.parent().unwrap().join("build"); | ||
let cg_clif_dylib_path = build_dir.join(if cfg!(windows) { "bin" } else { "lib" }).join( | ||
env::consts::DLL_PREFIX.to_string() + "rustc_codegen_cranelift" + env::consts::DLL_SUFFIX, | ||
); | ||
println!("cg_clif_dylib_path: {}", cg_clif_dylib_path.display()); | ||
|
||
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"]; | ||
|
||
for pair in pairs { | ||
eprintln!("[ABI-CHECKER] Running pair {pair}"); | ||
|
||
let mut cmd = Command::new("cargo"); | ||
cmd.arg("run"); | ||
cmd.arg("--target"); | ||
cmd.arg(target_triple); | ||
cmd.arg("--"); | ||
cmd.arg("--pairs"); | ||
cmd.arg(pair); | ||
cmd.arg("--add-rustc-codegen-backend"); | ||
cmd.arg(format!("cgclif:{}", cg_clif_dylib_path.display())); | ||
|
||
let output = spawn_and_wait_with_input(cmd, "".to_string()); | ||
|
||
// TODO: The correct thing to do here is to check the exit code, but abi-checker | ||
// currently doesn't return 0 on success, so check for the test fail count. | ||
// See: https://github.com/Gankra/abi-checker/issues/10 | ||
let failed = !(output.contains("0 failed") && output.contains("0 completely failed")); | ||
if failed { | ||
panic!("abi-checker for pair {} failed!", pair); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.