@@ -177,6 +177,32 @@ fn a_build_past_its_output_limit_fails_without_retaining_the_excess() {
177177 ) ;
178178}
179179
180+ /// The public defaults, rather than test-only reduced limits, exceed the historical stream and line
181+ /// caps.
182+ #[ test]
183+ fn default_output_limits_accept_large_streams_and_lines ( ) {
184+ const OLD_STREAM_LIMIT : usize = 4 * 1024 * 1024 ;
185+ const LINE_LENGTH : usize = 128 * 1024 ;
186+
187+ let mut output = Vec :: with_capacity ( OLD_STREAM_LIMIT + LINE_LENGTH ) ;
188+ while output. len ( ) <= OLD_STREAM_LIMIT {
189+ output. extend ( std:: iter:: repeat_n ( b'x' , LINE_LENGTH - 1 ) ) ;
190+ output. push ( b'\n' ) ;
191+ }
192+
193+ let ( sender, lines) = mpsc:: sync_channel ( 64 ) ;
194+ let pipe = read_pipe ( io:: Cursor :: new ( output. clone ( ) ) , Stream :: Prose , & sender)
195+ . expect ( "spawn reader" )
196+ . join ( )
197+ . expect ( "reader" ) ;
198+ drop ( sender) ;
199+ drop ( lines) ;
200+
201+ assert_eq ! ( pipe. text, output) ;
202+ assert ! ( pipe. complete) ;
203+ assert ! ( pipe. within_limits, "the production defaults regressed to their old bounds" ) ;
204+ }
205+
180206/// A small retained cap records truncation while continuing to drain the pipe.
181207#[ test]
182208fn an_over_limit_pipe_keeps_only_its_configured_prefix ( ) {
@@ -367,17 +393,23 @@ fn a_narrowed_build_that_fails_is_retried_across_the_whole_workspace() {
367393 assert ! ( build. widened, "the build should have reported that it widened" ) ;
368394}
369395
370- /// Examples remain part of the compilation oracle even though they are never test binaries .
396+ /// Targets that cargo-gamma will not run do not belong to its compilation oracle .
371397#[ test]
372- fn the_final_build_still_compiles_examples ( ) {
373- let ( _dir, work) = trivial_workspace ( "build-example -" ) ;
398+ fn the_final_build_does_not_compile_examples_or_benches ( ) {
399+ let ( _dir, work) = trivial_workspace ( "build-non-test-targets -" ) ;
374400
375401 fs:: create_dir_all ( work. root . join ( "examples" ) . as_std_path ( ) ) . expect ( "examples" ) ;
376402 fs:: write (
377403 work. root . join ( "examples/broken.rs" ) . as_std_path ( ) ,
378404 "fn main() { let _: i32 = \" not an integer\" ; }\n " ,
379405 )
380406 . expect ( "example" ) ;
407+ fs:: create_dir_all ( work. root . join ( "benches" ) . as_std_path ( ) ) . expect ( "benches" ) ;
408+ fs:: write (
409+ work. root . join ( "benches/broken.rs" ) . as_std_path ( ) ,
410+ "fn main() { let _: i32 = \" not an integer\" ; }\n " ,
411+ )
412+ . expect ( "bench" ) ;
381413
382414 let mut plan = empty_plan ( & work) ;
383415 let build = Converger :: default ( )
@@ -388,13 +420,13 @@ fn the_final_build_still_compiles_examples() {
388420 BuildLimits :: default ( ) ,
389421 & mut crate :: testing:: Recorder :: default ( ) ,
390422 )
391- . expect ( "the build reports the example failure " ) ;
423+ . expect ( "non-test targets are not part of the build " ) ;
392424
425+ assert ! ( build. stuck. is_none( ) , "examples and benches must not affect the test oracle" ) ;
393426 assert ! (
394- build. stuck . is_some ( ) ,
395- "a broken example must not disappear from the compilation oracle "
427+ ! build. binaries . is_empty ( ) ,
428+ "the test oracle still contains its runnable test binary "
396429 ) ;
397- assert ! ( build. binaries. is_empty( ) , "a failed compilation produces no runnable oracle" ) ;
398430}
399431
400432/// A workspace of two members, one of which does not compile and is not being mutated.
@@ -1034,6 +1066,23 @@ fn each_build_gets_the_whole_round_budget_rather_than_what_earlier_builds_left()
10341066 assert_eq ! ( converger. withdrawn( ) , 2 , "withdrawals carry across builds" ) ;
10351067}
10361068
1069+ /// A check-stage duration cannot budget a later code-generating test-target build.
1070+ #[ test]
1071+ fn each_build_calibrates_its_own_timeout_reference ( ) {
1072+ let mut converger = Converger {
1073+ rounds : 7 ,
1074+ per_round : vec ! [ 3 , 1 ] ,
1075+ first_round : Some ( Duration :: from_millis ( 1 ) ) ,
1076+ ..Converger :: default ( )
1077+ } ;
1078+
1079+ converger. begin_convergence ( ) ;
1080+
1081+ assert_eq ! ( converger. rounds, 0 ) ;
1082+ assert ! ( converger. per_round. is_empty( ) ) ;
1083+ assert_eq ! ( converger. first_round, None ) ;
1084+ }
1085+
10371086/// The limit error reads a series of withdrawal counts and gives falling-or-flat advice from
10381087/// it, so the series has to describe the build that just failed. Counts left over from earlier
10391088/// builds would have it describe work the reader is not being told about.
0 commit comments