@@ -129,6 +129,11 @@ pub struct TestProps {
129129 pub check_stdout : bool ,
130130 // Check stdout & stderr for output of run-pass test
131131 pub check_run_results : bool ,
132+ /// Check that stdout from running the binary is legal JSON Lines
133+ /// (i.e. each line is well-formed JSON).
134+ ///
135+ /// Has no effect in tests that don't run the compiled binary.
136+ pub check_run_stdout_is_json_lines : bool ,
132137 // For UI tests, allows compiler to generate arbitrary output to stdout
133138 pub dont_check_compiler_stdout : bool ,
134139 // For UI tests, allows compiler to generate arbitrary output to stderr
@@ -226,6 +231,7 @@ mod directives {
226231 pub const FORCE_HOST : & ' static str = "force-host" ;
227232 pub const CHECK_STDOUT : & ' static str = "check-stdout" ;
228233 pub const CHECK_RUN_RESULTS : & ' static str = "check-run-results" ;
234+ pub const CHECK_RUN_STDOUT_IS_JSON_LINES : & ' static str = "check-run-stdout-is-json-lines" ;
229235 pub const DONT_CHECK_COMPILER_STDOUT : & ' static str = "dont-check-compiler-stdout" ;
230236 pub const DONT_CHECK_COMPILER_STDERR : & ' static str = "dont-check-compiler-stderr" ;
231237 pub const NO_PREFER_DYNAMIC : & ' static str = "no-prefer-dynamic" ;
@@ -285,6 +291,7 @@ impl TestProps {
285291 force_host : false ,
286292 check_stdout : false ,
287293 check_run_results : false ,
294+ check_run_stdout_is_json_lines : false ,
288295 dont_check_compiler_stdout : false ,
289296 dont_check_compiler_stderr : false ,
290297 compare_output_lines_by_subset : false ,
@@ -423,6 +430,11 @@ impl TestProps {
423430 DONT_CHECK_COMPILER_STDOUT ,
424431 & mut self . dont_check_compiler_stdout ,
425432 ) ;
433+ config. set_name_directive (
434+ ln,
435+ CHECK_RUN_STDOUT_IS_JSON_LINES ,
436+ & mut self . check_run_stdout_is_json_lines ,
437+ ) ;
426438 config. set_name_directive (
427439 ln,
428440 DONT_CHECK_COMPILER_STDERR ,
@@ -739,6 +751,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
739751 "check-fail" ,
740752 "check-pass" ,
741753 "check-run-results" ,
754+ "check-run-stdout-is-json-lines" ,
742755 "check-stdout" ,
743756 "check-test-line-numbers-match" ,
744757 "compare-output-lines-by-subset" ,
0 commit comments