]> git.proxmox.com Git - rustc.git/blame - src/compiletest/common.rs
Imported Upstream version 1.0.0~beta.3
[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,
1a4d82fc
JJ
28}
29
1a4d82fc 30impl FromStr for Mode {
85aaf69f
SL
31 type Err = ();
32 fn from_str(s: &str) -> Result<Mode, ()> {
1a4d82fc 33 match s {
85aaf69f
SL
34 "compile-fail" => Ok(CompileFail),
35 "parse-fail" => Ok(ParseFail),
36 "run-fail" => Ok(RunFail),
37 "run-pass" => Ok(RunPass),
38 "run-pass-valgrind" => Ok(RunPassValgrind),
39 "pretty" => Ok(Pretty),
40 "debuginfo-lldb" => Ok(DebugInfoLldb),
41 "debuginfo-gdb" => Ok(DebugInfoGdb),
42 "codegen" => Ok(Codegen),
9346a6ac 43 "rustdoc" => Ok(Rustdoc),
85aaf69f 44 _ => Err(()),
1a4d82fc
JJ
45 }
46 }
47}
223e47cc 48
85aaf69f 49impl fmt::Display for Mode {
1a4d82fc 50 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
85aaf69f 51 fmt::Display::fmt(match *self {
1a4d82fc 52 CompileFail => "compile-fail",
85aaf69f 53 ParseFail => "parse-fail",
1a4d82fc
JJ
54 RunFail => "run-fail",
55 RunPass => "run-pass",
56 RunPassValgrind => "run-pass-valgrind",
57 Pretty => "pretty",
58 DebugInfoGdb => "debuginfo-gdb",
59 DebugInfoLldb => "debuginfo-lldb",
60 Codegen => "codegen",
9346a6ac 61 Rustdoc => "rustdoc",
1a4d82fc
JJ
62 }, f)
63 }
64}
223e47cc 65
1a4d82fc
JJ
66#[derive(Clone)]
67pub struct Config {
223e47cc 68 // The library paths required for running the compiler
1a4d82fc 69 pub compile_lib_path: String,
223e47cc
LB
70
71 // The library paths required for running compiled programs
1a4d82fc 72 pub run_lib_path: String,
223e47cc
LB
73
74 // The rustc executable
c34b1796 75 pub rustc_path: PathBuf,
1a4d82fc 76
9346a6ac
AL
77 // The rustdoc executable
78 pub rustdoc_path: PathBuf,
79
80 // The python executable
81 pub python: String,
82
1a4d82fc 83 // The clang executable
c34b1796 84 pub clang_path: Option<PathBuf>,
1a4d82fc
JJ
85
86 // The llvm binaries path
c34b1796 87 pub llvm_bin_path: Option<PathBuf>,
1a4d82fc
JJ
88
89 // The valgrind path
90 pub valgrind_path: Option<String>,
91
92 // Whether to fail if we can't run run-pass-valgrind tests under valgrind
93 // (or, alternatively, to silently run them like regular run-pass tests).
94 pub force_valgrind: bool,
223e47cc
LB
95
96 // The directory containing the tests to run
c34b1796 97 pub src_base: PathBuf,
223e47cc
LB
98
99 // The directory where programs should be built
c34b1796 100 pub build_base: PathBuf,
223e47cc
LB
101
102 // Directory for auxiliary libraries
c34b1796 103 pub aux_base: PathBuf,
223e47cc
LB
104
105 // The name of the stage being built (stage1, etc)
1a4d82fc 106 pub stage_id: String,
223e47cc
LB
107
108 // The test mode, compile-fail, run-fail, run-pass
1a4d82fc 109 pub mode: Mode,
223e47cc
LB
110
111 // Run ignored tests
1a4d82fc 112 pub run_ignored: bool,
223e47cc
LB
113
114 // Only run tests that match this filter
85aaf69f 115 pub filter: Option<String>,
223e47cc
LB
116
117 // Write out a parseable log of tests that were run
c34b1796 118 pub logfile: Option<PathBuf>,
1a4d82fc 119
223e47cc
LB
120 // A command line to prefix program execution with,
121 // for running under valgrind
1a4d82fc 122 pub runtool: Option<String>,
223e47cc 123
1a4d82fc
JJ
124 // Flags to pass to the compiler when building for the host
125 pub host_rustcflags: Option<String>,
223e47cc 126
1a4d82fc
JJ
127 // Flags to pass to the compiler when building for the target
128 pub target_rustcflags: Option<String>,
223e47cc 129
1a4d82fc
JJ
130 // Run tests using the JIT
131 pub jit: bool,
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
JJ
160 // Explain what's going on
161 pub verbose: bool
223e47cc 162}