1
Fork 0

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" name = "rustdoc-gui-test"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"build_helper",
"compiletest", "compiletest",
"getopts", "getopts",
"walkdir", "walkdir",

View file

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

View file

@ -1,3 +1,4 @@
use build_helper::util::try_run;
use compiletest::header::TestProps; use compiletest::header::TestProps;
use config::Config; use config::Config;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -60,23 +61,6 @@ fn find_librs<P: AsRef<Path>>(path: P) -> Option<PathBuf> {
None 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() { fn main() {
let config = Arc::new(Config::from_args(env::args().collect())); let config = Arc::new(Config::from_args(env::args().collect()));