pub use self::Mode::*;
use std::fmt;
use std::str::FromStr;
use std::path::PathBuf;
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Mode {
CompileFail,
ParseFail,
RunFail,
RunPass,
RunPassValgrind,
Pretty,
DebugInfoGdb,
DebugInfoLldb,
Codegen,
Rustdoc,
CodegenUnits,
Incremental,
RunMake,
Ui,
MirOpt,
}
impl FromStr for Mode {
type Err = ();
fn from_str(s: &str) -> Result<Mode, ()> {
match s {
"compile-fail" => Ok(CompileFail),
"parse-fail" => Ok(ParseFail),
"run-fail" => Ok(RunFail),
"run-pass" => Ok(RunPass),
"run-pass-valgrind" => Ok(RunPassValgrind),
"pretty" => Ok(Pretty),
"debuginfo-lldb" => Ok(DebugInfoLldb),
"debuginfo-gdb" => Ok(DebugInfoGdb),
"codegen" => Ok(Codegen),
"rustdoc" => Ok(Rustdoc),
"codegen-units" => Ok(CodegenUnits),
"incremental" => Ok(Incremental),
"run-make" => Ok(RunMake),
"ui" => Ok(Ui),
"mir-opt" => Ok(MirOpt),
_ => Err(()),
}
}
}
impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(match *self {
CompileFail => "compile-fail",
ParseFail => "parse-fail",
RunFail => "run-fail",
RunPass => "run-pass",
RunPassValgrind => "run-pass-valgrind",
Pretty => "pretty",
DebugInfoGdb => "debuginfo-gdb",
DebugInfoLldb => "debuginfo-lldb",
Codegen => "codegen",
Rustdoc => "rustdoc",
CodegenUnits => "codegen-units",
Incremental => "incremental",
RunMake => "run-make",
Ui => "ui",
MirOpt => "mir-opt",
},
f)
}
}
#[derive(Clone)]
pub struct Config {
pub compile_lib_path: PathBuf,
pub run_lib_path: PathBuf,
pub rustc_path: PathBuf,
pub rustdoc_path: PathBuf,
pub lldb_python: String,
pub docck_python: String,
pub llvm_filecheck: Option<PathBuf>,
pub valgrind_path: Option<String>,
pub force_valgrind: bool,
pub src_base: PathBuf,
pub build_base: PathBuf,
pub stage_id: String,
pub mode: Mode,
pub run_ignored: bool,
pub filter: Option<String>,
pub logfile: Option<PathBuf>,
pub runtool: Option<String>,
pub host_rustcflags: Option<String>,
pub target_rustcflags: Option<String>,
pub target: String,
pub host: String,
pub gdb_version: Option<String>,
pub lldb_version: Option<String>,
pub llvm_version: Option<String>,
pub android_cross_path: PathBuf,
pub adb_path: String,
pub adb_test_dir: String,
pub adb_device_status: bool,
pub lldb_python_dir: Option<String>,
pub verbose: bool,
pub quiet: bool,
pub cc: String,
pub cxx: String,
pub cflags: String,
pub llvm_components: String,
pub llvm_cxxflags: String,
}