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