@@ -12,7 +12,7 @@ use crate::compute_diff::{write_diff, write_filtered_diff};
1212use crate :: errors:: { self , Error , ErrorKind } ;
1313use crate :: header:: TestProps ;
1414use crate :: json;
15- use crate :: read2:: read2_abbreviated;
15+ use crate :: read2:: { read2_abbreviated, Truncated } ;
1616use crate :: util:: { add_dylib_path, dylib_env_var, logv, PathBufExt } ;
1717use crate :: ColorConfig ;
1818use regex:: { Captures , Regex } ;
@@ -701,6 +701,7 @@ impl<'test> TestCx<'test> {
701701 status : output. status ,
702702 stdout : String :: from_utf8 ( output. stdout ) . unwrap ( ) ,
703703 stderr : String :: from_utf8 ( output. stderr ) . unwrap ( ) ,
704+ truncated : Truncated :: No ,
704705 cmdline : format ! ( "{cmd:?}" ) ,
705706 } ;
706707 self . dump_output ( & proc_res. stdout , & proc_res. stderr ) ;
@@ -1275,6 +1276,7 @@ impl<'test> TestCx<'test> {
12751276 status,
12761277 stdout : String :: from_utf8 ( stdout) . unwrap ( ) ,
12771278 stderr : String :: from_utf8 ( stderr) . unwrap ( ) ,
1279+ truncated : Truncated :: No ,
12781280 cmdline,
12791281 } ;
12801282 if adb. kill ( ) . is_err ( ) {
@@ -1557,7 +1559,13 @@ impl<'test> TestCx<'test> {
15571559 } ;
15581560
15591561 self . dump_output ( & out, & err) ;
1560- ProcRes { status, stdout : out, stderr : err, cmdline : format ! ( "{:?}" , cmd) }
1562+ ProcRes {
1563+ status,
1564+ stdout : out,
1565+ stderr : err,
1566+ truncated : Truncated :: No ,
1567+ cmdline : format ! ( "{:?}" , cmd) ,
1568+ }
15611569 }
15621570
15631571 fn cleanup_debug_info_options ( & self , options : & Vec < String > ) -> Vec < String > {
@@ -2218,7 +2226,7 @@ impl<'test> TestCx<'test> {
22182226 dylib
22192227 }
22202228
2221- fn read2_abbreviated ( & self , child : Child ) -> Output {
2229+ fn read2_abbreviated ( & self , child : Child ) -> ( Output , Truncated ) {
22222230 let mut filter_paths_from_len = Vec :: new ( ) ;
22232231 let mut add_path = |path : & Path | {
22242232 let path = path. display ( ) . to_string ( ) ;
@@ -2265,12 +2273,13 @@ impl<'test> TestCx<'test> {
22652273 child. stdin . as_mut ( ) . unwrap ( ) . write_all ( input. as_bytes ( ) ) . unwrap ( ) ;
22662274 }
22672275
2268- let Output { status, stdout, stderr } = self . read2_abbreviated ( child) ;
2276+ let ( Output { status, stdout, stderr } , truncated ) = self . read2_abbreviated ( child) ;
22692277
22702278 let result = ProcRes {
22712279 status,
22722280 stdout : String :: from_utf8_lossy ( & stdout) . into_owned ( ) ,
22732281 stderr : String :: from_utf8_lossy ( & stderr) . into_owned ( ) ,
2282+ truncated,
22742283 cmdline,
22752284 } ;
22762285
@@ -3601,12 +3610,14 @@ impl<'test> TestCx<'test> {
36013610 }
36023611 }
36033612
3604- let output = self . read2_abbreviated ( cmd. spawn ( ) . expect ( "failed to spawn `make`" ) ) ;
3613+ let ( output, truncated) =
3614+ self . read2_abbreviated ( cmd. spawn ( ) . expect ( "failed to spawn `make`" ) ) ;
36053615 if !output. status . success ( ) {
36063616 let res = ProcRes {
36073617 status : output. status ,
36083618 stdout : String :: from_utf8_lossy ( & output. stdout ) . into_owned ( ) ,
36093619 stderr : String :: from_utf8_lossy ( & output. stderr ) . into_owned ( ) ,
3620+ truncated,
36103621 cmdline : format ! ( "{:?}" , cmd) ,
36113622 } ;
36123623 self . fatal_proc_rec ( "make failed" , & res) ;
@@ -3768,6 +3779,15 @@ impl<'test> TestCx<'test> {
37683779 let emit_metadata = self . should_emit_metadata ( pm) ;
37693780 let proc_res = self . compile_test ( should_run, emit_metadata) ;
37703781 self . check_if_test_should_compile ( & proc_res, pm) ;
3782+ if matches ! ( proc_res. truncated, Truncated :: Yes )
3783+ && !self . props . dont_check_compiler_stdout
3784+ && !self . props . dont_check_compiler_stderr
3785+ {
3786+ self . fatal_proc_rec (
3787+ & format ! ( "compiler output got truncated, cannot compare with reference file" ) ,
3788+ & proc_res,
3789+ ) ;
3790+ }
37713791
37723792 // if the user specified a format in the ui test
37733793 // print the output to the stderr file, otherwise extract
@@ -4459,6 +4479,7 @@ pub struct ProcRes {
44594479 status : ExitStatus ,
44604480 stdout : String ,
44614481 stderr : String ,
4482+ truncated : Truncated ,
44624483 cmdline : String ,
44634484}
44644485
0 commit comments