Skip to content

Commit

Permalink
Ensure Rustc::print use in rmake tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rejyr committed Jul 17, 2024
1 parent 0794061 commit 65cab6f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
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
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

0 comments on commit 65cab6f

Please sign in to comment.