@@ -268,11 +268,17 @@ fn bad_outfmt_1() {
268
268
}
269
269
270
270
fn run_with_biber ( args : & str , stdin : & str ) -> Output {
271
+ run_with_biber_exe ( None , args, stdin, & [ "subdirectory/empty.bib" ] )
272
+ }
273
+
274
+ fn run_with_biber_exe ( executable : Option < & str > , args : & str , stdin : & str , files : & [ & str ] ) -> Output {
271
275
let fmt_arg = get_plain_format_arg ( ) ;
272
- let tempdir = setup_and_copy_files ( & [ "subdirectory/empty.bib" ] ) ;
276
+ let tempdir = setup_and_copy_files ( files ) ;
273
277
let mut command = prep_tectonic ( tempdir. path ( ) , & [ & fmt_arg, "-" ] ) ;
274
278
275
- let test_cmd = if cfg ! ( windows) {
279
+ let test_cmd = if let Some ( exe) = executable {
280
+ format ! ( "{} {}" , exe, args)
281
+ } else if cfg ! ( windows) {
276
282
format ! (
277
283
"cmd /c {} {}" ,
278
284
util:: test_path( & [ "fake-biber.bat" ] ) . display( ) ,
@@ -358,28 +364,9 @@ fn biber_failure() {
358
364
359
365
#[ test]
360
366
fn biber_no_such_tool ( ) {
361
- let fmt_arg = get_plain_format_arg ( ) ;
362
- let tempdir = setup_and_copy_files ( & [ ] ) ;
363
- let mut command = prep_tectonic ( tempdir. path ( ) , & [ & fmt_arg, "-" ] ) ;
364
-
365
- command. env ( "TECTONIC_TEST_FAKE_BIBER" , "ohnothereisnobiberprogram" ) ;
366
-
367
367
const REST : & str = r"\bye" ;
368
368
let tex = format ! ( "{BIBER_TRIGGER_TEX}{REST}" ) ;
369
-
370
- command
371
- . stdin ( Stdio :: piped ( ) )
372
- . stdout ( Stdio :: piped ( ) )
373
- . stderr ( Stdio :: piped ( ) ) ;
374
- println ! ( "running {command:?}" ) ;
375
- let mut child = command. spawn ( ) . expect ( "tectonic failed to start" ) ;
376
-
377
- write ! ( child. stdin. as_mut( ) . unwrap( ) , "{tex}" )
378
- . expect ( "failed to send data to tectonic subprocess" ) ;
379
-
380
- let output = child
381
- . wait_with_output ( )
382
- . expect ( "failed to wait on tectonic subprocess" ) ;
369
+ let output = run_with_biber_exe ( Some ( "ohnothereisnobiberprogram" ) , "" , & tex, & [ ] ) ;
383
370
error_or_panic ( & output) ;
384
371
}
385
372
@@ -390,9 +377,7 @@ fn biber_signal() {
390
377
error_or_panic ( & output) ;
391
378
}
392
379
393
- #[ test]
394
- fn biber_success ( ) {
395
- const REST : & str = r"
380
+ const BIBER_VALIDATE_TEX : & str = r"
396
381
\ifsecond
397
382
\ifnum\input{biberout.qqq}=456\relax
398
383
a
401
386
\fi
402
387
\fi
403
388
\bye" ;
404
- let tex = format ! ( "{BIBER_TRIGGER_TEX}{REST}" ) ;
389
+
390
+ #[ test]
391
+ fn biber_success ( ) {
392
+ let tex = format ! ( "{BIBER_TRIGGER_TEX}{BIBER_VALIDATE_TEX}" ) ;
405
393
let output = run_with_biber ( "success" , & tex) ;
406
394
success_or_panic ( & output) ;
407
395
}
408
396
397
+ /// Test `tectonic-biber` override: when no args passed, fall back to $PATH
398
+ /// lookup for `tectonic-biber` first, and then `biber`. Currently defined in:
399
+ /// [`tectonic::driver::ProcessingSession::check_biber_requirement`]
400
+ #[ cfg( unix) ]
401
+ #[ test]
402
+ fn biber_tectonic_override ( ) {
403
+ let tex = format ! ( "{BIBER_TRIGGER_TEX}{BIBER_VALIDATE_TEX}" ) ;
404
+ let output = run_with_biber_exe (
405
+ Some ( "" ) ,
406
+ "" , // no args passed
407
+ & tex,
408
+ & [ "subdirectory/empty.bib" , "tectonic-biber" ] ,
409
+ ) ;
410
+ success_or_panic ( & output) ;
411
+ }
412
+
409
413
/// #844: biber input with absolute path blows away the file
410
414
///
411
415
/// We need to create a separate temporary directory to see if the abspath input
0 commit comments