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