@@ -303,11 +303,17 @@ fn bad_outfmt_1() {
303
303
}
304
304
305
305
fn run_with_biber ( args : & str , stdin : & str ) -> Output {
306
+ run_with_biber_exe ( None , args, stdin, & [ "subdirectory/empty.bib" ] )
307
+ }
308
+
309
+ fn run_with_biber_exe ( executable : Option < & str > , args : & str , stdin : & str , files : & [ & str ] ) -> Output {
306
310
let fmt_arg = get_plain_format_arg ( ) ;
307
- let tempdir = setup_and_copy_files ( & [ "subdirectory/empty.bib" ] ) ;
311
+ let tempdir = setup_and_copy_files ( files ) ;
308
312
let mut command = prep_tectonic ( tempdir. path ( ) , & [ & fmt_arg, "-" ] ) ;
309
313
310
- let test_cmd = if cfg ! ( windows) {
314
+ let test_cmd = if let Some ( exe) = executable {
315
+ format ! ( "{} {}" , exe, args)
316
+ } else if cfg ! ( windows) {
311
317
format ! (
312
318
"cmd /c {} {}" ,
313
319
util:: test_path( & [ "fake-biber.bat" ] ) . display( ) ,
@@ -393,28 +399,9 @@ fn biber_failure() {
393
399
394
400
#[ test]
395
401
fn biber_no_such_tool ( ) {
396
- let fmt_arg = get_plain_format_arg ( ) ;
397
- let tempdir = setup_and_copy_files ( & [ ] ) ;
398
- let mut command = prep_tectonic ( tempdir. path ( ) , & [ & fmt_arg, "-" ] ) ;
399
-
400
- command. env ( "TECTONIC_TEST_FAKE_BIBER" , "ohnothereisnobiberprogram" ) ;
401
-
402
402
const REST : & str = r"\bye" ;
403
403
let tex = format ! ( "{BIBER_TRIGGER_TEX}{REST}" ) ;
404
-
405
- command
406
- . stdin ( Stdio :: piped ( ) )
407
- . stdout ( Stdio :: piped ( ) )
408
- . stderr ( Stdio :: piped ( ) ) ;
409
- println ! ( "running {command:?}" ) ;
410
- let mut child = command. spawn ( ) . expect ( "tectonic failed to start" ) ;
411
-
412
- write ! ( child. stdin. as_mut( ) . unwrap( ) , "{tex}" )
413
- . expect ( "failed to send data to tectonic subprocess" ) ;
414
-
415
- let output = child
416
- . wait_with_output ( )
417
- . expect ( "failed to wait on tectonic subprocess" ) ;
404
+ let output = run_with_biber_exe ( Some ( "ohnothereisnobiberprogram" ) , "" , & tex, & [ ] ) ;
418
405
error_or_panic ( & output) ;
419
406
}
420
407
@@ -425,9 +412,7 @@ fn biber_signal() {
425
412
error_or_panic ( & output) ;
426
413
}
427
414
428
- #[ test]
429
- fn biber_success ( ) {
430
- const REST : & str = r"
415
+ const BIBER_VALIDATE_TEX : & str = r"
431
416
\ifsecond
432
417
\ifnum\input{biberout.qqq}=456\relax
433
418
a
436
421
\fi
437
422
\fi
438
423
\bye" ;
439
- let tex = format ! ( "{BIBER_TRIGGER_TEX}{REST}" ) ;
424
+
425
+ #[ test]
426
+ fn biber_success ( ) {
427
+ let tex = format ! ( "{BIBER_TRIGGER_TEX}{BIBER_VALIDATE_TEX}" ) ;
440
428
let output = run_with_biber ( "success" , & tex) ;
441
429
success_or_panic ( & output) ;
442
430
}
443
431
432
+ /// Test `tectonic-biber` override: when no args passed, fall back to $PATH
433
+ /// lookup for `tectonic-biber` first, and then `biber`. Currently defined in:
434
+ /// [`tectonic::driver::ProcessingSession::check_biber_requirement`]
435
+ #[ cfg( unix) ]
436
+ #[ test]
437
+ fn biber_tectonic_override ( ) {
438
+ let tex = format ! ( "{BIBER_TRIGGER_TEX}{BIBER_VALIDATE_TEX}" ) ;
439
+ let output = run_with_biber_exe (
440
+ Some ( "" ) ,
441
+ "" , // no args passed
442
+ & tex,
443
+ & [ "subdirectory/empty.bib" , "tectonic-biber" ] ,
444
+ ) ;
445
+ success_or_panic ( & output) ;
446
+ }
447
+
444
448
/// #844: biber input with absolute path blows away the file
445
449
///
446
450
/// We need to create a separate temporary directory to see if the abspath input
0 commit comments