]> git.proxmox.com Git - rustc.git/blame - src/compiletest/common.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / compiletest / common.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
223e47cc
LB
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.
1a4d82fc
JJ
10pub use self::Mode::*;
11
12use std::fmt;
13use std::str::FromStr;
c34b1796 14use std::path::PathBuf;
1a4d82fc 15
85aaf69f 16#[derive(Clone, Copy, PartialEq, Debug)]
1a4d82fc
JJ
17pub enum Mode {
18 CompileFail,
85aaf69f 19 ParseFail,
1a4d82fc
JJ
20 RunFail,
21 RunPass,
22 RunPassValgrind,
23 Pretty,
24 DebugInfoGdb,
25 DebugInfoLldb,
9346a6ac
AL
26 Codegen,
27 Rustdoc,
54a0048b
SL
28 CodegenUnits,
29 Incremental,
1a4d82fc
JJ
30}
31
1a4d82fc 32impl FromStr for Mode {
85aaf69f
SL
33 type Err = ();
34 fn from_str(s: &str) -> Result<Mode, ()> {
1a4d82fc 35 match s {
85aaf69f
SL
36 "compile-fail" => Ok(CompileFail),
37 "parse-fail" => Ok(ParseFail),
38 "run-fail" => Ok(RunFail),
39 "run-pass" => Ok(RunPass),
40 "run-pass-valgrind" => Ok(RunPassValgrind),
41 "pretty" => Ok(Pretty),
42 "debuginfo-lldb" => Ok(DebugInfoLldb),
43 "debuginfo-gdb" => Ok(DebugInfoGdb),
44 "codegen" => Ok(Codegen),
9346a6ac 45 "rustdoc" => Ok(Rustdoc),
7453a54e 46 "codegen-units" => Ok(CodegenUnits),
54a0048b 47 "incremental" => Ok(Incremental),
85aaf69f 48 _ => Err(()),
1a4d82fc
JJ
49 }
50 }
51}
223e47cc 52
85aaf69f 53impl fmt::Display for Mode {
1a4d82fc 54 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
85aaf69f 55 fmt::Display::fmt(match *self {
1a4d82fc 56 CompileFail => "compile-fail",
85aaf69f 57 ParseFail => "parse-fail",
1a4d82fc
JJ
58 RunFail => "run-fail",
59 RunPass => "run-pass",
60 RunPassValgrind => "run-pass-valgrind",
61 Pretty => "pretty",
62 DebugInfoGdb => "debuginfo-gdb",
63 DebugInfoLldb => "debuginfo-lldb",
64 Codegen => "codegen",
9346a6ac 65 Rustdoc => "rustdoc",
7453a54e 66 CodegenUnits => "codegen-units",
54a0048b 67 Incremental => "incremental",
1a4d82fc
JJ
68 }, f)
69 }
70}
223e47cc 71
1a4d82fc
JJ
72#[derive(Clone)]
73pub struct Config {
223e47cc 74 // The library paths required for running the compiler
54a0048b 75 pub compile_lib_path: PathBuf,
223e47cc
LB
76
77 // The library paths required for running compiled programs
54a0048b 78 pub run_lib_path: PathBuf,
223e47cc
LB
79
80 // The rustc executable
c34b1796 81 pub rustc_path: PathBuf,
1a4d82fc 82
9346a6ac
AL
83 // The rustdoc executable
84 pub rustdoc_path: PathBuf,
85
86 // The python executable
87 pub python: String,
88
1a4d82fc 89 // The llvm binaries path
c34b1796 90 pub llvm_bin_path: Option<PathBuf>,
1a4d82fc
JJ
91
92 // The valgrind path
93 pub valgrind_path: Option<String>,
94
95 // Whether to fail if we can't run run-pass-valgrind tests under valgrind
96 // (or, alternatively, to silently run them like regular run-pass tests).
97 pub force_valgrind: bool,
223e47cc
LB
98
99 // The directory containing the tests to run
c34b1796 100 pub src_base: PathBuf,
223e47cc
LB
101
102 // The directory where programs should be built
c34b1796 103 pub build_base: PathBuf,
223e47cc
LB
104
105 // Directory for auxiliary libraries
c34b1796 106 pub aux_base: PathBuf,
223e47cc
LB
107
108 // The name of the stage being built (stage1, etc)
1a4d82fc 109 pub stage_id: String,
223e47cc
LB
110
111 // The test mode, compile-fail, run-fail, run-pass
1a4d82fc 112 pub mode: Mode,
223e47cc
LB
113
114 // Run ignored tests
1a4d82fc 115 pub run_ignored: bool,
223e47cc
LB
116
117 // Only run tests that match this filter
85aaf69f 118 pub filter: Option<String>,
223e47cc
LB
119
120 // Write out a parseable log of tests that were run
c34b1796 121 pub logfile: Option<PathBuf>,
1a4d82fc 122
223e47cc
LB
123 // A command line to prefix program execution with,
124 // for running under valgrind
1a4d82fc 125 pub runtool: Option<String>,
223e47cc 126
1a4d82fc
JJ
127 // Flags to pass to the compiler when building for the host
128 pub host_rustcflags: Option<String>,
223e47cc 129
1a4d82fc
JJ
130 // Flags to pass to the compiler when building for the target
131 pub target_rustcflags: Option<String>,
223e47cc 132
970d7e83 133 // Target system to be tested
1a4d82fc
JJ
134 pub target: String,
135
136 // Host triple for the compiler being invoked
137 pub host: String,
138
139 // Version of GDB
140 pub gdb_version: Option<String>,
141
142 // Version of LLDB
143 pub lldb_version: Option<String>,
144
145 // Path to the android tools
c34b1796 146 pub android_cross_path: PathBuf,
970d7e83
LB
147
148 // Extra parameter to run adb on arm-linux-androideabi
1a4d82fc 149 pub adb_path: String,
970d7e83 150
1a4d82fc
JJ
151 // Extra parameter to run test suite on arm-linux-androideabi
152 pub adb_test_dir: String,
970d7e83
LB
153
154 // status whether android device available or not
1a4d82fc 155 pub adb_device_status: bool,
970d7e83 156
1a4d82fc
JJ
157 // the path containing LLDB's Python module
158 pub lldb_python_dir: Option<String>,
223e47cc 159
1a4d82fc 160 // Explain what's going on
54a0048b
SL
161 pub verbose: bool,
162
163 // Print one character per test instead of one line
164 pub quiet: bool,
223e47cc 165}