Rollup merge of #128937 - lqd:clean-rmake-tests, r=jieyouxu

Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`

r? `@jieyouxu`

This PR fixes some warnings I saw in rmake tests. I didn't deny more warnings in this PR until `@jieyouxu` gives their opinion, but maybe we should actually deny all warnings in `rmake.rs` files?

I've also only looked at non-ignored tests on `x86_64-unknown-linux-gnu`, and denying warnings would require a try build for all targets 😓.
This commit is contained in:
Guillaume Gomez 2024-08-12 17:09:19 +02:00 committed by GitHub
commit bb35b888b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 49 additions and 83 deletions

View File

@ -3,8 +3,6 @@
// Check that the `CURRENT_RUSTC_VERSION` placeholder is correctly replaced by the current
// `rustc` version and the `since` property in feature stability gating is properly respected.
use std::path::PathBuf;
use run_make_support::{aux_build, rfs, rustc, source_root};
fn main() {

View File

@ -4,8 +4,6 @@
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
pub fn main() {
use std::path::Path;
rustc().input("nonclike.rs").crate_type("staticlib").run();
cc().input("test.c")
.input(static_lib_name("nonclike"))

View File

@ -3,8 +3,6 @@
//@ ignore-cross-compile
use std::fs;
use run_make_support::rfs::remove_file;
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};

View File

@ -7,9 +7,7 @@
// FIXME(jieyouxu): check cross-compile setup
//@ ignore-cross-compile
use std::path::PathBuf;
use run_make_support::{cwd, env_var, llvm_readobj, rfs, run_in_tmpdir, rustc};
use run_make_support::{cwd, env_var, llvm_readobj, rfs, rustc};
fn main() {
let target = env_var("TARGET");

View File

@ -5,7 +5,7 @@
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc};
use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc};
fn check_compression(compression: &str, to_find: &str) {
run_in_tmpdir(|| {

View File

@ -2,7 +2,7 @@
//@ needs-unwind
use run_make_support::{cwd, diff, rustc};
use run_make_support::{diff, rustc};
fn main() {
rustc().input("main.rs").emit("mir").output("dump-actual.mir").run();

View File

@ -2,14 +2,13 @@
//@ ignore-wasm32
//@ ignore-wasm64
use run_make_support::rfs::copy;
use run_make_support::{assert_contains, rust_lib_name, rustc};
use run_make_support::{rust_lib_name, rustc};
fn main() {
rustc().input("multiple-dep-versions-1.rs").run();
rustc().input("multiple-dep-versions-2.rs").extra_filename("2").metadata("2").run();
let out = rustc()
rustc()
.input("multiple-dep-versions.rs")
.extern_("dependency", rust_lib_name("dependency"))
.extern_("dep_2_reexport", rust_lib_name("dependency2"))

View File

@ -4,7 +4,6 @@
//@ only-linux
//@ ignore-cross-compile
use run_make_support::regex::Regex;
use run_make_support::{cmd, run_in_tmpdir, rustc};
fn main() {

View File

@ -1,6 +1,6 @@
//@ ignore-cross-compile
use run_make_support::{cwd, run, rustc};
use run_make_support::{run, rustc};
// Attempt to build this dependency tree:
//

View File

@ -16,7 +16,7 @@
// If we used `rustc` the additional '-L rmake_out' option would allow rustc to
// actually find the crate.
use run_make_support::{bare_rustc, rfs, rust_lib_name, rustc};
use run_make_support::{bare_rustc, rust_lib_name, rustc};
fn main() {
rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run();

View File

@ -14,7 +14,7 @@
//@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for 'std'
use run_make_support::{rfs, rust_lib_name, rustc};
use run_make_support::{rfs, rustc};
fn main() {
rfs::create_dir("incr");

View File

@ -2,8 +2,6 @@
// (in this case, foo.py and foo.natvis) are picked up when compiling incrementally.
// See https://github.com/rust-lang/rust/pull/111641
use std::io::Read;
use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rfs, rustc};
fn main() {

View File

@ -7,7 +7,7 @@
//@ ignore-cross-compile
use run_make_support::{rfs, run, rust_lib_name, rustc, test_while_readonly};
use run_make_support::{run, rust_lib_name, rustc, test_while_readonly};
fn main() {
rustc().input("lib.rs").run();

View File

@ -1,4 +1,4 @@
use run_make_support::{cwd, path, rustc};
use run_make_support::{path, rustc};
fn main() {
rustc().input("foo.rs").emit("asm,llvm-ir").output("out").run();

View File

@ -3,7 +3,7 @@
use run_make_support::object::read::{File, Object, Symbol};
use run_make_support::object::ObjectSymbol;
use run_make_support::targets::is_windows;
use run_make_support::{dynamic_lib_name, env_var, rfs, rustc};
use run_make_support::{dynamic_lib_name, rfs, rustc};
fn main() {
let rdylib_name = dynamic_lib_name("a_rust_dylib");

View File

@ -8,7 +8,7 @@ fn main() {
match std::fs::create_dir(&non_unicode) {
// If an error occurs, check if creating a directory with a valid Unicode name would
// succeed.
Err(e) if std::fs::create_dir("valid_unicode").is_ok() => {
Err(_) if std::fs::create_dir("valid_unicode").is_ok() => {
// Filesystem doesn't appear support non-Unicode paths.
return;
}

View File

@ -113,7 +113,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "asm-emit".to_string(),
},
|| {
@ -123,7 +123,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "asm-emit2".to_string(),
},
|| {
@ -133,7 +133,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "asm-emit3".to_string(),
},
|| {
@ -144,7 +144,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-ir-emit".to_string(),
},
|| {
@ -154,7 +154,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-ir-emit2".to_string(),
},
|| {
@ -164,7 +164,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-ir-emit3".to_string(),
},
|| {
@ -175,7 +175,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-bc-emit".to_string(),
},
|| {
@ -185,7 +185,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-bc-emit2".to_string(),
},
|| {
@ -195,7 +195,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "llvm-bc-emit3".to_string(),
},
|| {
@ -206,7 +206,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "obj-emit".to_string(),
},
|| {
@ -216,7 +216,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "obj-emit2".to_string(),
},
|| {
@ -226,7 +226,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "obj-emit3".to_string(),
},
|| {
@ -268,7 +268,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "rlib".to_string(),
},
|| {
@ -278,7 +278,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "rlib2".to_string(),
},
|| {
@ -288,7 +288,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "rlib3".to_string(),
},
|| {
@ -375,7 +375,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "staticlib".to_string(),
},
|| {
@ -385,7 +385,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "staticlib2".to_string(),
},
|| {
@ -395,7 +395,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["foo"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "staticlib3".to_string(),
},
|| {
@ -449,7 +449,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["ir", rust_lib_name("bar")],
allowed_files: s![],
allowed_files: vec![],
test_dir: "rlib-ir".to_string(),
},
|| {
@ -466,7 +466,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["ir", "asm", "bc", "obj", "link"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "staticlib-all".to_string(),
},
|| {
@ -484,7 +484,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["ir", "asm", "bc", "obj", "link"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "staticlib-all2".to_string(),
},
|| {
@ -523,7 +523,7 @@ fn main() {
assert_expected_output_files(
Expectations {
expected_files: s!["bar.bc", rust_lib_name("bar"), "foo.bc"],
allowed_files: s![],
allowed_files: vec![],
test_dir: "rlib-emits".to_string(),
},
|| {

View File

@ -4,7 +4,6 @@ extern crate run_make_support;
use std::collections::HashSet;
use std::iter::FromIterator;
use std::ops::Deref;
use run_make_support::rustc;

View File

@ -12,8 +12,6 @@
//@ ignore-cross-compile
//@ ignore-wasm
use std::io::BufRead;
use run_make_support::{is_msvc, rustc};
fn main() {

View File

@ -11,9 +11,7 @@
//@ ignore-cross-compile
// Reason: the compiled binary is executed
use run_make_support::{
build_native_dynamic_lib, build_native_static_lib, cwd, is_msvc, rfs, run, rustc,
};
use run_make_support::{build_native_dynamic_lib, build_native_static_lib, run, rustc};
fn main() {
build_native_dynamic_lib("foo");

View File

@ -13,7 +13,7 @@
// 2. When the sysroot gets copied, some symlinks must be re-created,
// which is a privileged action on Windows.
use run_make_support::{bin_name, rfs, rust_lib_name, rustc};
use run_make_support::{rfs, rust_lib_name, rustc};
fn main() {
// test 1: fat lto

View File

@ -9,7 +9,7 @@
use std::path::Path;
use run_make_support::{bin_name, rfs, rustc};
use run_make_support::{bin_name, rustc};
fn compile(output_file: &str, emit: Option<&str>) {
let mut rustc = rustc();

View File

@ -6,7 +6,7 @@
// See https://github.com/rust-lang/rust/pull/105601
use run_make_support::{
build_native_static_lib, is_msvc, llvm_ar, regex, rfs, rust_lib_name, rustc, static_lib_name,
build_native_static_lib, llvm_ar, regex, rfs, rust_lib_name, rustc, static_lib_name,
};
//@ ignore-cross-compile

View File

@ -3,7 +3,7 @@
//! when returning from the closure.
use std::fs;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use run_make_support::{cwd, run_in_tmpdir};

View File

@ -6,8 +6,6 @@
//@ ignore-stable
//@ only-x86_64-unknown-linux-gnu
use std::process::Output;
use run_make_support::regex::Regex;
use run_make_support::rustc;

View File

@ -6,7 +6,7 @@
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc};
use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc};
fn check_compression(compression: &str, to_find: &str) {
run_in_tmpdir(|| {

View File

@ -8,8 +8,6 @@
//@ needs-rust-lld
//@ only-x86_64-unknown-linux-gnu
use std::process::Output;
use run_make_support::regex::Regex;
use run_make_support::rustc;

View File

@ -4,8 +4,6 @@
//@ needs-rust-lld
//@ ignore-s390x lld does not yet support s390x as target
use std::process::Output;
use run_make_support::regex::Regex;
use run_make_support::{is_msvc, rustc};

View File

@ -14,22 +14,20 @@
// `mkfs.ext4 -d`, as well as mounting a loop device for the rootfs.
//@ ignore-windows - the `set_readonly` functions doesn't work on folders.
use std::fs;
use run_make_support::{path, rustdoc};
use run_make_support::{path, rfs, rustdoc};
fn main() {
let out_dir = path("rustdoc-io-error");
let output = fs::create_dir(&out_dir).unwrap();
let mut permissions = fs::metadata(&out_dir).unwrap().permissions();
rfs::create_dir(&out_dir);
let mut permissions = rfs::metadata(&out_dir).permissions();
let original_permissions = permissions.clone();
permissions.set_readonly(true);
fs::set_permissions(&out_dir, permissions).unwrap();
rfs::set_permissions(&out_dir, permissions);
let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail();
fs::set_permissions(&out_dir, original_permissions).unwrap();
rfs::set_permissions(&out_dir, original_permissions);
output
.assert_exit_code(1)

View File

@ -1,6 +1,6 @@
use std::path::Path;
use run_make_support::{htmldocck, rfs, rustc, rustdoc, source_root};
use run_make_support::{htmldocck, rfs, rustc, rustdoc};
pub fn scrape(extra_args: &[&str]) {
let out_dir = Path::new("rustdoc");

View File

@ -4,10 +4,7 @@
// created for each source module (see `rustc_const_eval::monomorphize::partitioning`).
// See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc,
shallow_find_files,
};
use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc};
fn main() {
rustc().input("cci_lib.rs").run();

View File

@ -5,10 +5,7 @@
// in only one compilation unit.
// See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc,
shallow_find_files,
};
use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc};
fn main() {
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).arg("-Zinline-in-all-cgus").run();

View File

@ -3,10 +3,7 @@
// wind up in three different compilation units.
// See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc,
shallow_find_files,
};
use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc};
fn main() {
rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).run();