@@ -12,7 +12,7 @@ use crate::compute_diff::{write_diff, write_filtered_diff};
12
12
use crate :: errors:: { self , Error , ErrorKind } ;
13
13
use crate :: header:: TestProps ;
14
14
use crate :: json;
15
- use crate :: read2:: read2_abbreviated;
15
+ use crate :: read2:: { read2_abbreviated, Truncated } ;
16
16
use crate :: util:: { add_dylib_path, dylib_env_var, logv, PathBufExt } ;
17
17
use crate :: ColorConfig ;
18
18
use regex:: { Captures , Regex } ;
@@ -701,6 +701,7 @@ impl<'test> TestCx<'test> {
701
701
status : output. status ,
702
702
stdout : String :: from_utf8 ( output. stdout ) . unwrap ( ) ,
703
703
stderr : String :: from_utf8 ( output. stderr ) . unwrap ( ) ,
704
+ truncated : Truncated :: No ,
704
705
cmdline : format ! ( "{cmd:?}" ) ,
705
706
} ;
706
707
self . dump_output ( & proc_res. stdout , & proc_res. stderr ) ;
@@ -1275,6 +1276,7 @@ impl<'test> TestCx<'test> {
1275
1276
status,
1276
1277
stdout : String :: from_utf8 ( stdout) . unwrap ( ) ,
1277
1278
stderr : String :: from_utf8 ( stderr) . unwrap ( ) ,
1279
+ truncated : Truncated :: No ,
1278
1280
cmdline,
1279
1281
} ;
1280
1282
if adb. kill ( ) . is_err ( ) {
@@ -1557,7 +1559,13 @@ impl<'test> TestCx<'test> {
1557
1559
} ;
1558
1560
1559
1561
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
+ }
1561
1569
}
1562
1570
1563
1571
fn cleanup_debug_info_options ( & self , options : & Vec < String > ) -> Vec < String > {
@@ -2218,7 +2226,7 @@ impl<'test> TestCx<'test> {
2218
2226
dylib
2219
2227
}
2220
2228
2221
- fn read2_abbreviated ( & self , child : Child ) -> Output {
2229
+ fn read2_abbreviated ( & self , child : Child ) -> ( Output , Truncated ) {
2222
2230
let mut filter_paths_from_len = Vec :: new ( ) ;
2223
2231
let mut add_path = |path : & Path | {
2224
2232
let path = path. display ( ) . to_string ( ) ;
@@ -2265,12 +2273,13 @@ impl<'test> TestCx<'test> {
2265
2273
child. stdin . as_mut ( ) . unwrap ( ) . write_all ( input. as_bytes ( ) ) . unwrap ( ) ;
2266
2274
}
2267
2275
2268
- let Output { status, stdout, stderr } = self . read2_abbreviated ( child) ;
2276
+ let ( Output { status, stdout, stderr } , truncated ) = self . read2_abbreviated ( child) ;
2269
2277
2270
2278
let result = ProcRes {
2271
2279
status,
2272
2280
stdout : String :: from_utf8_lossy ( & stdout) . into_owned ( ) ,
2273
2281
stderr : String :: from_utf8_lossy ( & stderr) . into_owned ( ) ,
2282
+ truncated,
2274
2283
cmdline,
2275
2284
} ;
2276
2285
@@ -3601,12 +3610,14 @@ impl<'test> TestCx<'test> {
3601
3610
}
3602
3611
}
3603
3612
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`" ) ) ;
3605
3615
if !output. status . success ( ) {
3606
3616
let res = ProcRes {
3607
3617
status : output. status ,
3608
3618
stdout : String :: from_utf8_lossy ( & output. stdout ) . into_owned ( ) ,
3609
3619
stderr : String :: from_utf8_lossy ( & output. stderr ) . into_owned ( ) ,
3620
+ truncated,
3610
3621
cmdline : format ! ( "{:?}" , cmd) ,
3611
3622
} ;
3612
3623
self . fatal_proc_rec ( "make failed" , & res) ;
@@ -3768,6 +3779,15 @@ impl<'test> TestCx<'test> {
3768
3779
let emit_metadata = self . should_emit_metadata ( pm) ;
3769
3780
let proc_res = self . compile_test ( should_run, emit_metadata) ;
3770
3781
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
+ }
3771
3791
3772
3792
// if the user specified a format in the ui test
3773
3793
// print the output to the stderr file, otherwise extract
@@ -4459,6 +4479,7 @@ pub struct ProcRes {
4459
4479
status : ExitStatus ,
4460
4480
stdout : String ,
4461
4481
stderr : String ,
4482
+ truncated : Truncated ,
4462
4483
cmdline : String ,
4463
4484
}
4464
4485
0 commit comments