Skip to content

Assorted run-make-support maintenance #143683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,7 @@ dependencies = [

[[package]]
name = "run_make_support"
version = "0.2.0"
version = "0.0.0"
dependencies = [
"bstr",
"build_helper",
Expand Down
83 changes: 0 additions & 83 deletions src/tools/run-make-support/CHANGELOG.md

This file was deleted.

21 changes: 15 additions & 6 deletions src/tools/run-make-support/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
[package]
name = "run_make_support"
version = "0.2.0"
edition = "2021"
version = "0.0.0"
edition = "2024"

[dependencies]

# These dependencies are either used to implement part of support library
# functionality, or re-exported to test recipe programs via the support library,
# or both.

# tidy-alphabetical-start
bstr = "1.12"
gimli = "0.32"
libc = "0.2"
object = "0.37"
regex = "1.11"
serde_json = "1.0"
similar = "2.7"
wasmparser = { version = "0.219", default-features = false, features = ["std"] }
regex = "1.11"
gimli = "0.32"
# tidy-alphabetical-end

# Shared with bootstrap and compiletest
build_helper = { path = "../../build_helper" }
serde_json = "1.0"
libc = "0.2"

[lib]
crate-type = ["lib", "dylib"]
108 changes: 42 additions & 66 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
//! notably is built via cargo: this means that if your test wants some non-trivial utility, such
//! as `object` or `wasmparser`, they can be re-exported and be made available through this library.
// We want to control use declaration ordering and spacing (and preserve use group comments), so
// skip rustfmt on this file.
#![cfg_attr(rustfmt, rustfmt::skip)]
#![warn(unreachable_pub)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have the option to configure rustfmt through some magic comment directly in the file :)

Copy link
Member Author

@jieyouxu jieyouxu Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying reason for this particular skip is that rustfmt doesn't really tie comments to use statements, so they get moved all over the place.

Ignoring a whole file to rustfmt seems usually undesirable, so I think it's fine we don't have such magic comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant more like a comment that changes e.g. the use grouping method only for a given file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see.


mod command;
Expand All @@ -22,8 +19,8 @@ pub mod path_helpers;
pub mod run;
pub mod scoped_run;
pub mod string;
pub mod targets;
pub mod symbols;
pub mod targets;

// Internally we call our fs-related support module as `fs`, but re-export its content as `rfs`
// to tests to avoid colliding with commonly used `use std::fs;`.
Expand All @@ -36,77 +33,56 @@ pub mod rfs {
}

// Re-exports of third-party library crates.
// tidy-alphabetical-start
pub use bstr;
pub use gimli;
pub use libc;
pub use object;
pub use regex;
pub use serde_json;
pub use similar;
pub use wasmparser;
// tidy-alphabetical-end
pub use {bstr, gimli, libc, object, regex, serde_json, similar, wasmparser};

// Re-exports of external dependencies.
pub use external_deps::{
cargo, c_build, c_cxx_compiler, clang, htmldocck, llvm, python, rustc, rustdoc
// Helpers for building names of output artifacts that are potentially target-specific.
pub use crate::artifact_names::{
bin_name, dynamic_lib_extension, dynamic_lib_name, msvc_import_dynamic_lib_name, rust_lib_name,
static_lib_name,
};

// These rely on external dependencies.
pub use c_cxx_compiler::{Cc, Gcc, cc, cxx, extra_c_flags, extra_cxx_flags, gcc};
pub use c_build::{
pub use crate::assertion_helpers::{
assert_contains, assert_contains_regex, assert_count_is, assert_dirs_are_equal, assert_equals,
assert_not_contains, assert_not_contains_regex,
};
// `diff` is implemented in terms of the [similar] library.
//
// [similar]: https://github.com/mitsuhiko/similar
pub use crate::diff::{Diff, diff};
// Panic-on-fail [`std::env::var`] and [`std::env::var_os`] wrappers.
pub use crate::env::{env_var, env_var_os, set_current_dir};
pub use crate::external_deps::c_build::{
build_native_dynamic_lib, build_native_static_lib, build_native_static_lib_cxx,
build_native_static_lib_optimized,
};
pub use cargo::cargo;
pub use clang::{clang, Clang};
pub use htmldocck::htmldocck;
pub use llvm::{
llvm_ar, llvm_bcanalyzer, llvm_dis, llvm_dwarfdump, llvm_filecheck, llvm_nm, llvm_objcopy,
llvm_objdump, llvm_profdata, llvm_readobj, LlvmAr, LlvmBcanalyzer, LlvmDis, LlvmDwarfdump,
LlvmFilecheck, LlvmNm, LlvmObjcopy, LlvmObjdump, LlvmProfdata, LlvmReadobj,
};
pub use python::python_command;
pub use rustc::{bare_rustc, rustc, rustc_path, Rustc};
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};

/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
///
/// [similar]: https://github.com/mitsuhiko/similar
pub use diff::{diff, Diff};

/// Panic-on-fail [`std::env::var`] and [`std::env::var_os`] wrappers.
pub use env::{env_var, env_var_os, set_current_dir};

/// Convenience helpers for running binaries and other commands.
pub use run::{cmd, run, run_fail, run_with_args};

/// Helpers for checking target information.
pub use targets::{
apple_os, is_aix, is_darwin, is_msvc, is_windows, is_windows_gnu, is_windows_msvc, is_win7, llvm_components_contain,
target, uname,
// Re-exports of external dependencies.
pub use crate::external_deps::c_cxx_compiler::{
Cc, Gcc, cc, cxx, extra_c_flags, extra_cxx_flags, gcc,
};

/// Helpers for building names of output artifacts that are potentially target-specific.
pub use artifact_names::{
bin_name, dynamic_lib_extension, dynamic_lib_name, msvc_import_dynamic_lib_name, rust_lib_name,
static_lib_name,
pub use crate::external_deps::cargo::cargo;
pub use crate::external_deps::clang::{Clang, clang};
pub use crate::external_deps::htmldocck::htmldocck;
pub use crate::external_deps::llvm::{
self, LlvmAr, LlvmBcanalyzer, LlvmDis, LlvmDwarfdump, LlvmFilecheck, LlvmNm, LlvmObjcopy,
LlvmObjdump, LlvmProfdata, LlvmReadobj, llvm_ar, llvm_bcanalyzer, llvm_dis, llvm_dwarfdump,
llvm_filecheck, llvm_nm, llvm_objcopy, llvm_objdump, llvm_profdata, llvm_readobj,
};

/// Path-related helpers.
pub use path_helpers::{
pub use crate::external_deps::python::python_command;
pub use crate::external_deps::rustc::{self, Rustc, bare_rustc, rustc, rustc_path};
pub use crate::external_deps::rustdoc::{Rustdoc, bare_rustdoc, rustdoc};
// Path-related helpers.
pub use crate::path_helpers::{
build_root, cwd, filename_contains, filename_not_in_denylist, has_extension, has_prefix,
has_suffix, not_contains, path, shallow_find_directories, shallow_find_files, source_root,
};

/// Helpers for scoped test execution where certain properties are attempted to be maintained.
pub use scoped_run::{run_in_tmpdir, test_while_readonly};

pub use assertion_helpers::{
assert_contains, assert_contains_regex, assert_count_is, assert_dirs_are_equal, assert_equals,
assert_not_contains, assert_not_contains_regex,
};

pub use string::{
// Convenience helpers for running binaries and other commands.
pub use crate::run::{cmd, run, run_fail, run_with_args};
// Helpers for scoped test execution where certain properties are attempted to be maintained.
pub use crate::scoped_run::{run_in_tmpdir, test_while_readonly};
pub use crate::string::{
count_regex_matches_in_files_with_extension, invalid_utf8_contains, invalid_utf8_not_contains,
};
// Helpers for checking target information.
pub use crate::targets::{
apple_os, is_aix, is_darwin, is_msvc, is_win7, is_windows, is_windows_gnu, is_windows_msvc,
llvm_components_contain, target, uname,
};