Ensure Rustc::print use in rmake tests

This commit is contained in:
Jerry Wang 2024-07-17 17:54:06 -04:00
parent 1ca959e3f0
commit 36cf385e88
No known key found for this signature in database
GPG Key ID: B9657729C5192EDC
4 changed files with 4 additions and 11 deletions

View File

@ -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;
@ -91,10 +90,8 @@ fn check_(output: &str, includes: &[&str], disallow: &[&str]) {
// --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);

View File

@ -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();

View File

@ -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};
@ -44,10 +43,8 @@ fn check_(output: &str, includes: &[&str]) {
// --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)
};

View File

@ -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();