use `build_helper::util::try_run` in rustdoc-gui-test

Signed-off-by: ozkanonur <work@onurozkan.dev>
This commit is contained in:
ozkanonur 2023-05-30 10:54:40 +03:00
parent 2803c66006
commit c64db2cfa7
3 changed files with 3 additions and 17 deletions

View File

@ -4383,6 +4383,7 @@ dependencies = [
name = "rustdoc-gui-test"
version = "0.1.0"
dependencies = [
"build_helper",
"compiletest",
"getopts",
"walkdir",

View File

@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
build_helper = { path = "../build_helper" }
compiletest = { path = "../compiletest" }
getopts = "0.2"
walkdir = "2"

View File

@ -1,3 +1,4 @@
use build_helper::util::try_run;
use compiletest::header::TestProps;
use config::Config;
use std::path::{Path, PathBuf};
@ -60,23 +61,6 @@ fn find_librs<P: AsRef<Path>>(path: P) -> Option<PathBuf> {
None
}
// FIXME: move `bootstrap::util::try_run` into `build_helper` crate
// and use that one instead of creating this function.
fn try_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool {
let status = match cmd.status() {
Ok(status) => status,
Err(e) => panic!("failed to execute command: {:?}\nerror: {}", cmd, e),
};
if !status.success() && print_cmd_on_fail {
println!(
"\n\ncommand did not execute successfully: {:?}\n\
expected success, got: {}\n\n",
cmd, status
);
}
status.success()
}
fn main() {
let config = Arc::new(Config::from_args(env::args().collect()));