Skip to content

Commit

Permalink
Auto merge of #127877 - Rejyr:migrate-print-rmake, r=jieyouxu
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Aug 4, 2024
2 parents b389b0a + 36cf385 commit 58fb508
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 25 deletions.
2 changes: 0 additions & 2 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/print-calling-conventions/Makefile

This file was deleted.

5 changes: 1 addition & 4 deletions tests/run-make/print-cfg/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -91,10 +90,8 @@ fn check(PrintCfg { target, includes, disallow }: PrintCfg) {
// --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);

Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/print-check-cfg/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 0 additions & 8 deletions tests/run-make/print-target-list/Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions tests/run-make/print-target-list/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
}
}
5 changes: 1 addition & 4 deletions tests/run-make/print-to-output/rmake.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -44,10 +43,8 @@ fn check(args: Option) {
// --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)
};
Expand Down
3 changes: 1 addition & 2 deletions tests/run-make/rustdoc-scrape-examples-macros/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/print-calling-conventions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//@ compile-flags: --print calling-conventions
//@ build-pass
34 changes: 34 additions & 0 deletions tests/ui/print-calling-conventions.stdout
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 58fb508

Please sign in to comment.