@@ -12,7 +12,7 @@ use self::TargetLocation::*;
12
12
13
13
use common:: Config ;
14
14
use common:: { CompileFail , ParseFail , Pretty , RunFail , RunPass , RunPassValgrind } ;
15
- use common:: { Codegen , DebugInfoLldb , DebugInfoGdb } ;
15
+ use common:: { Codegen , DebugInfoLldb , DebugInfoGdb , Rustdoc } ;
16
16
use errors;
17
17
use header:: TestProps ;
18
18
use header;
@@ -57,15 +57,16 @@ pub fn run_metrics(config: Config, testfile: &Path, mm: &mut MetricMap) {
57
57
let props = header:: load_props ( & testfile) ;
58
58
debug ! ( "loaded props" ) ;
59
59
match config. mode {
60
- CompileFail => run_cfail_test ( & config, & props, & testfile) ,
61
- ParseFail => run_cfail_test ( & config, & props, & testfile) ,
62
- RunFail => run_rfail_test ( & config, & props, & testfile) ,
63
- RunPass => run_rpass_test ( & config, & props, & testfile) ,
64
- RunPassValgrind => run_valgrind_test ( & config, & props, & testfile) ,
65
- Pretty => run_pretty_test ( & config, & props, & testfile) ,
66
- DebugInfoGdb => run_debuginfo_gdb_test ( & config, & props, & testfile) ,
67
- DebugInfoLldb => run_debuginfo_lldb_test ( & config, & props, & testfile) ,
68
- Codegen => run_codegen_test ( & config, & props, & testfile, mm) ,
60
+ CompileFail => run_cfail_test ( & config, & props, & testfile) ,
61
+ ParseFail => run_cfail_test ( & config, & props, & testfile) ,
62
+ RunFail => run_rfail_test ( & config, & props, & testfile) ,
63
+ RunPass => run_rpass_test ( & config, & props, & testfile) ,
64
+ RunPassValgrind => run_valgrind_test ( & config, & props, & testfile) ,
65
+ Pretty => run_pretty_test ( & config, & props, & testfile) ,
66
+ DebugInfoGdb => run_debuginfo_gdb_test ( & config, & props, & testfile) ,
67
+ DebugInfoLldb => run_debuginfo_lldb_test ( & config, & props, & testfile) ,
68
+ Codegen => run_codegen_test ( & config, & props, & testfile, mm) ,
69
+ Rustdoc => run_rustdoc_test ( & config, & props, & testfile) ,
69
70
}
70
71
}
71
72
@@ -725,32 +726,37 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
725
726
-> ProcRes {
726
727
// Prepare the lldb_batchmode which executes the debugger script
727
728
let lldb_script_path = rust_src_root. join ( "src/etc/lldb_batchmode.py" ) ;
729
+ cmd2proces ( config,
730
+ test_executable,
731
+ Command :: new ( & config. python )
732
+ . arg ( & lldb_script_path)
733
+ . arg ( test_executable)
734
+ . arg ( debugger_script)
735
+ . env ( "PYTHONPATH" ,
736
+ config. lldb_python_dir . as_ref ( ) . unwrap ( ) ) )
737
+ }
738
+ }
728
739
729
- let mut cmd = Command :: new ( "python" ) ;
730
- cmd. arg ( & lldb_script_path)
731
- . arg ( test_executable)
732
- . arg ( debugger_script)
733
- . env ( "PYTHONPATH" , config. lldb_python_dir . as_ref ( ) . unwrap ( ) ) ;
734
-
735
- let ( status, out, err) = match cmd. output ( ) {
736
- Ok ( Output { status, stdout, stderr } ) => {
737
- ( status,
738
- String :: from_utf8 ( stdout) . unwrap ( ) ,
739
- String :: from_utf8 ( stderr) . unwrap ( ) )
740
- } ,
741
- Err ( e) => {
742
- fatal ( & format ! ( "Failed to setup Python process for \
743
- LLDB script: {}", e) )
744
- }
745
- } ;
740
+ fn cmd2proces ( config : & Config , test_executable : & Path , cmd : & mut Command )
741
+ -> ProcRes {
742
+ let ( status, out, err) = match cmd. output ( ) {
743
+ Ok ( Output { status, stdout, stderr } ) => {
744
+ ( status,
745
+ String :: from_utf8 ( stdout) . unwrap ( ) ,
746
+ String :: from_utf8 ( stderr) . unwrap ( ) )
747
+ } ,
748
+ Err ( e) => {
749
+ fatal ( & format ! ( "Failed to setup Python process for \
750
+ LLDB script: {}", e) )
751
+ }
752
+ } ;
746
753
747
- dump_output ( config, test_executable, & out, & err) ;
748
- return ProcRes {
749
- status : Status :: Normal ( status) ,
750
- stdout : out,
751
- stderr : err,
752
- cmdline : format ! ( "{:?}" , cmd)
753
- } ;
754
+ dump_output ( config, test_executable, & out, & err) ;
755
+ ProcRes {
756
+ status : Status :: Normal ( status) ,
757
+ stdout : out,
758
+ stderr : err,
759
+ cmdline : format ! ( "{:?}" , cmd)
754
760
}
755
761
}
756
762
@@ -1157,6 +1163,24 @@ fn compile_test_(config: &Config, props: &TestProps,
1157
1163
compose_and_run_compiler ( config, props, testfile, args, None )
1158
1164
}
1159
1165
1166
+ fn document ( config : & Config , props : & TestProps ,
1167
+ testfile : & Path , extra_args : & [ String ] ) -> ( ProcRes , PathBuf ) {
1168
+ let aux_dir = aux_output_dir_name ( config, testfile) ;
1169
+ let out_dir = output_base_name ( config, testfile) ;
1170
+ ensure_dir ( & out_dir) ;
1171
+ let mut args = vec ! [ "-L" . to_string( ) ,
1172
+ aux_dir. to_str( ) . unwrap( ) . to_string( ) ,
1173
+ "-o" . to_string( ) ,
1174
+ out_dir. to_str( ) . unwrap( ) . to_string( ) ,
1175
+ testfile. to_str( ) . unwrap( ) . to_string( ) ] ;
1176
+ args. extend ( extra_args. iter ( ) . cloned ( ) ) ;
1177
+ let args = ProcArgs {
1178
+ prog : config. rustdoc_path . to_str ( ) . unwrap ( ) . to_string ( ) ,
1179
+ args : args,
1180
+ } ;
1181
+ ( compose_and_run_compiler ( config, props, testfile, args, None ) , out_dir)
1182
+ }
1183
+
1160
1184
fn exec_compiled_test ( config : & Config , props : & TestProps ,
1161
1185
testfile : & Path ) -> ProcRes {
1162
1186
@@ -1181,20 +1205,17 @@ fn exec_compiled_test(config: &Config, props: &TestProps,
1181
1205
}
1182
1206
}
1183
1207
1184
- fn compose_and_run_compiler (
1185
- config : & Config ,
1186
- props : & TestProps ,
1187
- testfile : & Path ,
1188
- args : ProcArgs ,
1189
- input : Option < String > ) -> ProcRes {
1190
-
1208
+ fn compose_and_run_compiler ( config : & Config , props : & TestProps ,
1209
+ testfile : & Path , args : ProcArgs ,
1210
+ input : Option < String > ) -> ProcRes {
1191
1211
if !props. aux_builds . is_empty ( ) {
1192
1212
ensure_dir ( & aux_output_dir_name ( config, testfile) ) ;
1193
1213
}
1194
1214
1195
1215
let aux_dir = aux_output_dir_name ( config, testfile) ;
1196
1216
// FIXME (#9639): This needs to handle non-utf8 paths
1197
- let extra_link_args = vec ! ( "-L" . to_string( ) , aux_dir. to_str( ) . unwrap( ) . to_string( ) ) ;
1217
+ let extra_link_args = vec ! [ "-L" . to_string( ) ,
1218
+ aux_dir. to_str( ) . unwrap( ) . to_string( ) ] ;
1198
1219
1199
1220
for rel_ab in & props. aux_builds {
1200
1221
let abs_ab = config. aux_base . join ( rel_ab) ;
@@ -1330,8 +1351,8 @@ fn make_exe_name(config: &Config, testfile: &Path) -> PathBuf {
1330
1351
f
1331
1352
}
1332
1353
1333
- fn make_run_args ( config : & Config , props : & TestProps , testfile : & Path ) ->
1334
- ProcArgs {
1354
+ fn make_run_args ( config : & Config , props : & TestProps , testfile : & Path )
1355
+ -> ProcArgs {
1335
1356
// If we've got another tool to run under (valgrind),
1336
1357
// then split apart its command
1337
1358
let mut args = split_maybe_args ( & config. runtool ) ;
@@ -1797,3 +1818,21 @@ fn charset() -> &'static str {
1797
1818
"UTF-8"
1798
1819
}
1799
1820
}
1821
+
1822
+ fn run_rustdoc_test ( config : & Config , props : & TestProps , testfile : & Path ) {
1823
+ let ( proc_res, out_dir) = document ( config, props, testfile, & [ ] ) ;
1824
+ if !proc_res. status . success ( ) {
1825
+ fatal_proc_rec ( "rustdoc failed!" , & proc_res) ;
1826
+ }
1827
+ let root = find_rust_src_root ( config) . unwrap ( ) ;
1828
+
1829
+ let res = cmd2proces ( config,
1830
+ testfile,
1831
+ Command :: new ( & config. python )
1832
+ . arg ( root. join ( "src/etc/htmldocck.py" ) )
1833
+ . arg ( out_dir)
1834
+ . arg ( testfile) ) ;
1835
+ if !res. status . success ( ) {
1836
+ fatal_proc_rec ( "htmldocck failed!" , & res) ;
1837
+ }
1838
+ }
0 commit comments