Auto merge of #127877 - Rejyr:migrate-print-rmake, r=jieyouxu

Migrate `print-target-list` to `rmake` and  `print-calling-convention` to ui-test

Part of #121876.

r? `@jieyouxu`

try-job: x86_64-gnu-llvm-18
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: i686-mingw
try-job: x86_64-msvc
This commit is contained in:
bors 2024-08-04 09:31:24 +00:00
commit 58fb508fe3
10 changed files with 61 additions and 25 deletions

View file

@ -23,8 +23,6 @@ run-make/no-alloc-shim/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile
run-make/pgo-gen-lto/Makefile
run-make/pgo-indirect-call-promotion/Makefile
run-make/print-calling-conventions/Makefile
run-make/print-target-list/Makefile
run-make/raw-dylib-alt-calling-convention/Makefile
run-make/raw-dylib-c/Makefile
run-make/redundant-libs/Makefile

View file

@ -1,4 +0,0 @@
include ../tools.mk
all:
$(RUSTC) --print calling-conventions

View file

@ -6,7 +6,6 @@
//! It also checks that some targets have the correct set cfgs.
use std::collections::HashSet;
use std::ffi::OsString;
use std::iter::FromIterator;
use std::path::PathBuf;
@ -91,10 +90,8 @@ fn check_(output: &str, includes: &[&str], disallow: &[&str]) {
// --print=cfg=PATH
{
let tmp_path = PathBuf::from(format!("{target}.cfg"));
let mut print_arg = OsString::from("--print=cfg=");
print_arg.push(tmp_path.as_os_str());
rustc().target(target).arg(print_arg).run();
rustc().target(target).print(&format!("cfg={}", tmp_path.display())).run();
let output = rfs::read_to_string(&tmp_path);

View file

@ -87,7 +87,7 @@ fn main() {
fn check(CheckCfg { args, contains }: CheckCfg) {
let output =
rustc().input("lib.rs").arg("-Zunstable-options").arg("--print=check-cfg").args(args).run();
rustc().input("lib.rs").arg("-Zunstable-options").print("check-cfg").args(args).run();
let stdout = output.stdout_utf8();

View file

@ -1,8 +0,0 @@
include ../tools.mk
# Checks that all the targets returned by `rustc --print target-list` are valid
# target specifications
all:
for target in $(shell $(BARE_RUSTC) --print target-list); do \
$(BARE_RUSTC) --target $$target --print sysroot; \
done

View file

@ -0,0 +1,21 @@
// Checks that all the targets returned by `rustc --print target-list` are valid
// target specifications
use run_make_support::bare_rustc;
// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine'
// in CI, so we skip them
const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"];
fn main() {
let targets = bare_rustc().print("target-list").run().stdout_utf8();
for target in targets.lines() {
// skip experimental targets that would otherwise fail
if EXPERIMENTAL_TARGETS.iter().any(|experimental| target.contains(experimental)) {
continue;
}
bare_rustc().target(target).print("sysroot").run();
}
}

View file

@ -1,7 +1,6 @@
//! This checks the output of some `--print` options when
//! output to a file (instead of stdout)
use std::ffi::OsString;
use std::path::PathBuf;
use run_make_support::{rfs, rustc, target};
@ -44,10 +43,8 @@ fn check_(output: &str, includes: &[&str]) {
// --print={option}=PATH
let output = {
let tmp_path = PathBuf::from(format!("{}.txt", args.option));
let mut print_arg = OsString::from(format!("--print={}=", args.option));
print_arg.push(tmp_path.as_os_str());
rustc().target(args.target).arg(print_arg).run();
rustc().target(args.target).print(&format!("{}={}", args.option, tmp_path.display())).run();
rfs::read_to_string(&tmp_path)
};

View file

@ -11,8 +11,7 @@ fn main() {
let dylib_name = rustc()
.crate_name(proc_crate_name)
.crate_type("dylib")
.arg("--print")
.arg("file-names")
.print("file-names")
.arg("-")
.run()
.stdout_utf8();

View file

@ -0,0 +1,2 @@
//@ compile-flags: --print calling-conventions
//@ build-pass

View file

@ -0,0 +1,34 @@
C
C-cmse-nonsecure-call
C-unwind
Rust
aapcs
aapcs-unwind
avr-interrupt
avr-non-blocking-interrupt
cdecl
cdecl-unwind
efiapi
fastcall
fastcall-unwind
msp430-interrupt
ptx-kernel
riscv-interrupt-m
riscv-interrupt-s
rust-call
rust-cold
rust-intrinsic
stdcall
stdcall-unwind
system
system-unwind
sysv64
sysv64-unwind
thiscall
thiscall-unwind
unadjusted
vectorcall
vectorcall-unwind
win64
win64-unwind
x86-interrupt