Skip to content

Commit 3955b3a

Browse files
committed
refactor so that pretty mode tests also run aux-build. Fixes #2060.
1 parent 18a97d7 commit 3955b3a

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

Diff for: src/compiletest/runtest.rs

+27-14
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
130130
compare_source(expected, actual);
131131

132132
// Finally, let's make sure it actually appears to remain valid code
133-
let procres = typecheck_source(config, testfile, actual);
133+
let procres = typecheck_source(config, props, testfile, actual);
134134

135135
if procres.status != 0 {
136136
fatal_procres("pretty-printed source does not typecheck", procres);
@@ -169,9 +169,10 @@ actual:\n\
169169
}
170170
}
171171

172-
fn typecheck_source(config: config, testfile: str, src: str) -> procres {
173-
compose_and_run(config, testfile, make_typecheck_args,
174-
config.compile_lib_path, option::some(src))
172+
fn typecheck_source(config: config, props: test_props,
173+
testfile: str, src: str) -> procres {
174+
compose_and_run_compiler(
175+
config, props, testfile, make_typecheck_args, option::some(src))
175176
}
176177

177178
fn make_typecheck_args(config: config, _testfile: str) -> procargs {
@@ -285,6 +286,25 @@ type procres = {status: int, stdout: str, stderr: str, cmdline: str};
285286

286287
fn compile_test(config: config, props: test_props,
287288
testfile: str) -> procres {
289+
compose_and_run_compiler(config, props, testfile,
290+
make_compile_args(_, props, [], make_exe_name, _),
291+
none)
292+
}
293+
294+
fn exec_compiled_test(config: config, props: test_props,
295+
testfile: str) -> procres {
296+
compose_and_run(config, testfile,
297+
bind make_run_args(_, props, _),
298+
config.run_lib_path, option::none)
299+
}
300+
301+
fn compose_and_run_compiler(
302+
config: config,
303+
props: test_props,
304+
testfile: str,
305+
mk_args: fn(config: config, _testfile: str) -> procargs,
306+
input: option<str>) -> procres {
307+
288308
vec::iter(props.aux_builds) {|rel_ab|
289309
let abs_ab = path::connect(config.aux_base, rel_ab);
290310
let auxres = compose_and_run(config, abs_ab,
@@ -298,19 +318,12 @@ fn compile_test(config: config, props: test_props,
298318
}
299319
}
300320

301-
compose_and_run(config, testfile,
302-
make_compile_args(_, props, [], make_exe_name, _),
303-
config.compile_lib_path, option::none)
304-
}
305-
306-
fn exec_compiled_test(config: config, props: test_props,
307-
testfile: str) -> procres {
308-
compose_and_run(config, testfile, bind make_run_args(_, props, _),
309-
config.run_lib_path, option::none)
321+
compose_and_run(config, testfile, mk_args,
322+
config.compile_lib_path, input)
310323
}
311324

312325
fn compose_and_run(config: config, testfile: str,
313-
make_args: fn@(config, str) -> procargs, lib_path: str,
326+
make_args: fn(config, str) -> procargs, lib_path: str,
314327
input: option<str>) -> procres {
315328
let procargs = make_args(config, testfile);
316329
ret program_output(config, testfile, lib_path,

0 commit comments

Comments
 (0)