Skip to content

Commit

Permalink
Rollup merge of rust-lang#134680 - lqd:run-make-cleanup, r=jieyouxu
Browse files Browse the repository at this point in the history
Clean up a few rmake tests

Now I'm aware it's a bit late to start participating in the Advent of Tests, but here are a few cleanups in the rmake tests to put under the 🎄 anyways. A handful of unused imports, some warnings, and a couple typos.

r? `@jieyouxu` 🎅
  • Loading branch information
matthiaskrgr authored Dec 23, 2024
2 parents a62f245 + 6f19bd0 commit a16fc10
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/run-make/dump-ice-to-disk/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn extract_exactly_one_ice_file<P: AsRef<Path>>(name: &'static str, dir: P) -> I

fn main() {
// Establish baseline ICE message.
let mut default_ice_dump = OnceCell::new();
let default_ice_dump = OnceCell::new();
run_in_tmpdir(|| {
rustc().env("RUSTC_ICE", cwd()).input("lib.rs").arg("-Ztreat-err-as-bug=1").run_fail();
let dump = extract_exactly_one_ice_file("baseline", cwd());
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/embed-source-dwarf/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::rc::Rc;

use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian};
use gimli::{EndianRcSlice, Reader, RunTimeEndian};
use object::{Object, ObjectSection};
use run_make_support::{gimli, object, rfs, rustc};

Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/import-macro-verbatim/verbatim.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Include a file by concating the verbatim path using `/` instead of `\`
//! Include a file by concatenating the verbatim path using `/` instead of `\`
include!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/libstd-no-protected/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use run_make_support::object::Endianness;
use run_make_support::object::read::archive::ArchiveFile;
use run_make_support::object::read::elf::{FileHeader as _, SectionHeader as _};
use run_make_support::rfs::{read, read_dir};
use run_make_support::rfs::read;
use run_make_support::{has_prefix, has_suffix, object, path, rustc, shallow_find_files, target};

type FileHeader = run_make_support::object::elf::FileHeader64<Endianness>;
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/libtest-thread-limit/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
// Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere
// else that uses panic=abort.

use std::ffi::{self, CStr, CString};
use std::path::PathBuf;

use run_make_support::{libc, run, rustc};
use run_make_support::{libc, rustc};

fn main() {
rustc().input("test.rs").arg("--test").run();
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/llvm-outputs/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fn main() {
let mut path_ir = PathBuf::new();
run_in_tmpdir(|| {
let p = cwd();
path_bc = p.join("nonexistant_dir_bc");
path_ir = p.join("nonexistant_dir_ir");
path_bc = p.join("nonexistent_dir_bc");
path_ir = p.join("nonexistent_dir_ir");
rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_bc).emit("llvm-bc").run();
rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_ir).emit("llvm-ir").run();
assert!(path_bc.exists());
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/missing-unstable-trait-bound/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue
// mentioning the rest of the obligation chain.

use run_make_support::{diff, rust_lib_name, rustc};
use run_make_support::{diff, rustc};

fn main() {
let out = rustc()
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/musl-default-linking/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn main() {
let default = &target_spec["crt-static-default"];

// If the value is `null`, then the default to dynamically link from
// musl_base was not overriden.
// musl_base was not overridden.
if default.is_null() {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/no-alloc-shim/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Tracking issue: /~https://github.com/rust-lang/rust/issues/128602
// Discussion: /~https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172

use run_make_support::{cc, cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
use run_make_support::{cc, has_extension, has_prefix, run, rustc, shallow_find_files};

fn main() {
rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/no-builtins-lto/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// The rlib produced by a no_builtins crate should be explicitely linked
// The rlib produced by a no_builtins crate should be explicitly linked
// during compilation, and as a result be present in the linker arguments.
// See the comments inside this file for more details.
// See /~https://github.com/rust-lang/rust/pull/35637
Expand Down
13 changes: 6 additions & 7 deletions tests/run-make/remove-dir-all-race/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//@ ignore-windows

// This test attempts to make sure that running `remove_dir_all`
// doesn't result in a NotFound error one of the files it
// doesn't result in a NotFound error if one of the files it
// is deleting is deleted concurrently.
//
// The windows implementation for `remove_dir_all` is significantly
// more complicated, and has not yet been brought up to par with
// the implementation on other platforms, so this test is marked as
// `ignore-windows` until someone more expirenced with windows can
// `ignore-windows` until someone more experienced with windows can
// sort that out.

use std::fs::remove_dir_all;
Expand All @@ -27,13 +27,12 @@ fn main() {
write("outer/inner.txt", b"sometext");

thread::scope(|scope| {
let t1 = scope.spawn(|| {
scope.spawn(|| {
thread::sleep(Duration::from_nanos(i));
remove_dir_all("outer").unwrap();
});

let race_happened_ref = &race_happened;
let t2 = scope.spawn(|| {
scope.spawn(|| {
let r1 = remove_dir_all("outer/inner");
let r2 = remove_dir_all("outer/inner.txt");
if r1.is_ok() && r2.is_err() {
Expand All @@ -44,10 +43,10 @@ fn main() {

assert!(!Path::new("outer").exists());

// trying to remove a nonexistant top-level directory should
// trying to remove a nonexistent top-level directory should
// still result in an error.
let Err(err) = remove_dir_all("outer") else {
panic!("removing nonexistant dir did not result in an error");
panic!("removing nonexistent dir did not result in an error");
};
assert_eq!(err.kind(), std::io::ErrorKind::NotFound);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/rustdoc-map-file/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// This test ensures that all items from `foo` are correctly generated into the `redirect-map.json`
// file with `--generate-redirect-map` rustdoc option.

use std::path::Path;

use run_make_support::rfs::read_to_string;
use run_make_support::{path, rustdoc, serde_json};

Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/rustdoc-output-stdout/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
// a JSON file.

use std::path::PathBuf;

use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
use run_make_support::{rustdoc, serde_json};

Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/symbol-visibility/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Dynamic libraries on Rust used to export a very high amount of symbols,
// going as far as filling the output with mangled names and generic function
// names. After the rework of #38117, this test checks that no mangled Rust symbols
// are exported, and that generics are only shown if explicitely requested.
// are exported, and that generics are only shown if explicitly requested.
// See /~https://github.com/rust-lang/rust/issues/37530

use run_make_support::object::read::Object;
Expand Down

0 comments on commit a16fc10

Please sign in to comment.