]> git.lizzy.rs Git - rust.git/blob - src/compiletest/common.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[rust.git] / src / compiletest / common.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 pub use self::Mode::*;
11
12 use std::fmt;
13 use std::str::FromStr;
14
15 #[derive(Clone, Copy, PartialEq, Debug)]
16 pub enum Mode {
17     CompileFail,
18     ParseFail,
19     RunFail,
20     RunPass,
21     RunPassValgrind,
22     Pretty,
23     DebugInfoGdb,
24     DebugInfoLldb,
25     Codegen
26 }
27
28 impl FromStr for Mode {
29     type Err = ();
30     fn from_str(s: &str) -> Result<Mode, ()> {
31         match s {
32           "compile-fail" => Ok(CompileFail),
33           "parse-fail" => Ok(ParseFail),
34           "run-fail" => Ok(RunFail),
35           "run-pass" => Ok(RunPass),
36           "run-pass-valgrind" => Ok(RunPassValgrind),
37           "pretty" => Ok(Pretty),
38           "debuginfo-lldb" => Ok(DebugInfoLldb),
39           "debuginfo-gdb" => Ok(DebugInfoGdb),
40           "codegen" => Ok(Codegen),
41           _ => Err(()),
42         }
43     }
44 }
45
46 impl fmt::Display for Mode {
47     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48         fmt::Display::fmt(match *self {
49             CompileFail => "compile-fail",
50             ParseFail => "parse-fail",
51             RunFail => "run-fail",
52             RunPass => "run-pass",
53             RunPassValgrind => "run-pass-valgrind",
54             Pretty => "pretty",
55             DebugInfoGdb => "debuginfo-gdb",
56             DebugInfoLldb => "debuginfo-lldb",
57             Codegen => "codegen",
58         }, f)
59     }
60 }
61
62 #[derive(Clone)]
63 pub struct Config {
64     // The library paths required for running the compiler
65     pub compile_lib_path: String,
66
67     // The library paths required for running compiled programs
68     pub run_lib_path: String,
69
70     // The rustc executable
71     pub rustc_path: Path,
72
73     // The clang executable
74     pub clang_path: Option<Path>,
75
76     // The llvm binaries path
77     pub llvm_bin_path: Option<Path>,
78
79     // The valgrind path
80     pub valgrind_path: Option<String>,
81
82     // Whether to fail if we can't run run-pass-valgrind tests under valgrind
83     // (or, alternatively, to silently run them like regular run-pass tests).
84     pub force_valgrind: bool,
85
86     // The directory containing the tests to run
87     pub src_base: Path,
88
89     // The directory where programs should be built
90     pub build_base: Path,
91
92     // Directory for auxiliary libraries
93     pub aux_base: Path,
94
95     // The name of the stage being built (stage1, etc)
96     pub stage_id: String,
97
98     // The test mode, compile-fail, run-fail, run-pass
99     pub mode: Mode,
100
101     // Run ignored tests
102     pub run_ignored: bool,
103
104     // Only run tests that match this filter
105     pub filter: Option<String>,
106
107     // Write out a parseable log of tests that were run
108     pub logfile: Option<Path>,
109
110     // A command line to prefix program execution with,
111     // for running under valgrind
112     pub runtool: Option<String>,
113
114     // Flags to pass to the compiler when building for the host
115     pub host_rustcflags: Option<String>,
116
117     // Flags to pass to the compiler when building for the target
118     pub target_rustcflags: Option<String>,
119
120     // Run tests using the JIT
121     pub jit: bool,
122
123     // Target system to be tested
124     pub target: String,
125
126     // Host triple for the compiler being invoked
127     pub host: String,
128
129     // Version of GDB
130     pub gdb_version: Option<String>,
131
132     // Version of LLDB
133     pub lldb_version: Option<String>,
134
135     // Path to the android tools
136     pub android_cross_path: Path,
137
138     // Extra parameter to run adb on arm-linux-androideabi
139     pub adb_path: String,
140
141     // Extra parameter to run test suite on arm-linux-androideabi
142     pub adb_test_dir: String,
143
144     // status whether android device available or not
145     pub adb_device_status: bool,
146
147     // the path containing LLDB's Python module
148     pub lldb_python_dir: Option<String>,
149
150     // Explain what's going on
151     pub verbose: bool
152 }