@@ -39,6 +39,11 @@ pub mod errors;
39
39
pub fn main ( ) {
40
40
let args = os:: args ( ) ;
41
41
let config = parse_config ( args) ;
42
+
43
+ if config. valgrind_path . is_none ( ) && config. force_valgrind {
44
+ fail ! ( "Can't find Valgrind to run Valgrind tests" ) ;
45
+ }
46
+
42
47
log_config ( & config) ;
43
48
run_tests ( & config) ;
44
49
}
@@ -50,7 +55,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
50
55
reqopt( "" , "run-lib-path" , "path to target shared libraries" , "PATH" ) ,
51
56
reqopt( "" , "rustc-path" , "path to rustc to use for compiling" , "PATH" ) ,
52
57
optopt( "" , "clang-path" , "path to executable for codegen tests" , "PATH" ) ,
53
- optopt( "" , "valgrind-path" , "path to valgrind executable for valgrind tests" , "PROGRAM" ) ,
58
+ optopt( "" , "valgrind-path" , "path to Valgrind executable for Valgrind tests" , "PROGRAM" ) ,
59
+ optflag( "" , "force-valgrind" , "fail if Valgrind tests cannot be run under Valgrind" ) ,
54
60
optopt( "" , "llvm-bin-path" , "path to directory holding llvm binaries" , "DIR" ) ,
55
61
reqopt( "" , "src-base" , "directory to scan for test files" , "PATH" ) ,
56
62
reqopt( "" , "build-base" , "directory to deposit test outputs" , "PATH" ) ,
@@ -127,6 +133,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
127
133
rustc_path : opt_path ( matches, "rustc-path" ) ,
128
134
clang_path : matches. opt_str ( "clang-path" ) . map ( |s| Path :: new ( s) ) ,
129
135
valgrind_path : matches. opt_str ( "valgrind-path" ) ,
136
+ force_valgrind : matches. opt_present ( "force-valgrind" ) ,
130
137
llvm_bin_path : matches. opt_str ( "llvm-bin-path" ) . map ( |s| Path :: new ( s) ) ,
131
138
src_base : opt_path ( matches, "src-base" ) ,
132
139
build_base : opt_path ( matches, "build-base" ) ,
@@ -164,7 +171,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
164
171
!opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
165
172
lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
166
173
test_shard : test:: opt_shard ( matches. opt_str ( "test-shard" ) ) ,
167
- verbose : matches. opt_present ( "verbose" )
174
+ verbose : matches. opt_present ( "verbose" ) ,
168
175
}
169
176
}
170
177
0 commit comments