Skip to content

Commit

Permalink
Rollup merge of rust-lang#128937 - lqd:clean-rmake-tests, r=jieyouxu
Browse files Browse the repository at this point in the history
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 😓.
  • Loading branch information
matthiaskrgr authored Aug 12, 2024
2 parents 530f481 + dcd6170 commit 4211fa8
Show file tree
Hide file tree
Showing 33 changed files with 49 additions and 83 deletions.
2 changes: 0 additions & 2 deletions tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/arguments-non-c-like-enum/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/c-link-to-rust-staticlib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
4 changes: 1 addition & 3 deletions tests/run-make/comment-section/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/compressed-debuginfo/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|| {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/const_fn_mir/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 2 additions & 3 deletions tests/run-make/crate-loading/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 0 additions & 1 deletion tests/run-make/dylib-soname/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/extern-flag-disambiguates/rmake.rs
Original file line number Diff line number Diff line change
@@ -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:
//
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/ice-dep-cannot-find-dep/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/incr-test-moved-file/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/incremental-debugger-visualizer/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/lto-readonly-lib/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/multiple-emits/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/naked-symbol-visibility/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/non-unicode-in-incremental-dir/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
44 changes: 22 additions & 22 deletions tests/run-make/output-type-permutations/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand Down Expand Up @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand Down Expand Up @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand Down Expand Up @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand All @@ -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(),
},
|| {
Expand Down Expand Up @@ -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(),
},
|| {
Expand Down
1 change: 0 additions & 1 deletion tests/run-make/print-check-cfg/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/print-native-static-libs/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//@ ignore-cross-compile
//@ ignore-wasm

use std::io::BufRead;

use run_make_support::{is_msvc, rustc};

fn main() {
Expand Down
4 changes: 1 addition & 3 deletions tests/run-make/redundant-libs/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/reproducible-build-2/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/reset-codegen-1/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 4211fa8

Please sign in to comment.