@@ -391,139 +391,143 @@ impl TestProps {
391
391
/// `//[foo]`), then the property is ignored unless `cfg` is
392
392
/// `Some("foo")`.
393
393
fn load_from ( & mut self , testfile : & Path , cfg : Option < & str > , config : & Config ) {
394
- let file = File :: open ( testfile) . unwrap ( ) ;
395
- iter_header ( testfile, cfg, file, & mut |ln| {
396
- if let Some ( ep) = config. parse_error_pattern ( ln) {
397
- self . error_patterns . push ( ep) ;
398
- }
394
+ if !testfile. is_dir ( ) {
395
+ let file = File :: open ( testfile) . unwrap ( ) ;
399
396
400
- if let Some ( flags) = config. parse_compile_flags ( ln) {
401
- self . compile_flags . extend ( flags. split_whitespace ( ) . map ( |s| s. to_owned ( ) ) ) ;
402
- }
397
+ iter_header ( testfile, cfg, file, & mut |ln| {
398
+ if let Some ( ep) = config. parse_error_pattern ( ln) {
399
+ self . error_patterns . push ( ep) ;
400
+ }
403
401
404
- if let Some ( edition ) = config. parse_edition ( ln) {
405
- self . compile_flags . push ( format ! ( "--edition={}" , edition ) ) ;
406
- }
402
+ if let Some ( flags ) = config. parse_compile_flags ( ln) {
403
+ self . compile_flags . extend ( flags . split_whitespace ( ) . map ( |s| s . to_owned ( ) ) ) ;
404
+ }
407
405
408
- if let Some ( r ) = config. parse_revisions ( ln) {
409
- self . revisions . extend ( r ) ;
410
- }
406
+ if let Some ( edition ) = config. parse_edition ( ln) {
407
+ self . compile_flags . push ( format ! ( "--edition={}" , edition ) ) ;
408
+ }
411
409
412
- if self . run_flags . is_none ( ) {
413
- self . run_flags = config . parse_run_flags ( ln ) ;
414
- }
410
+ if let Some ( r ) = config . parse_revisions ( ln ) {
411
+ self . revisions . extend ( r ) ;
412
+ }
415
413
416
- if self . pp_exact . is_none ( ) {
417
- self . pp_exact = config. parse_pp_exact ( ln, testfile ) ;
418
- }
414
+ if self . run_flags . is_none ( ) {
415
+ self . run_flags = config. parse_run_flags ( ln) ;
416
+ }
419
417
420
- if ! self . should_ice {
421
- self . should_ice = config. parse_should_ice ( ln) ;
422
- }
418
+ if self . pp_exact . is_none ( ) {
419
+ self . pp_exact = config. parse_pp_exact ( ln, testfile ) ;
420
+ }
423
421
424
- if !self . build_aux_docs {
425
- self . build_aux_docs = config. parse_build_aux_docs ( ln) ;
426
- }
422
+ if !self . should_ice {
423
+ self . should_ice = config. parse_should_ice ( ln) ;
424
+ }
427
425
428
- if !self . force_host {
429
- self . force_host = config. parse_force_host ( ln) ;
430
- }
426
+ if !self . build_aux_docs {
427
+ self . build_aux_docs = config. parse_build_aux_docs ( ln) ;
428
+ }
431
429
432
- if !self . check_stdout {
433
- self . check_stdout = config. parse_check_stdout ( ln) ;
434
- }
430
+ if !self . force_host {
431
+ self . force_host = config. parse_force_host ( ln) ;
432
+ }
435
433
436
- if !self . check_run_results {
437
- self . check_run_results = config. parse_check_run_results ( ln) ;
438
- }
434
+ if !self . check_stdout {
435
+ self . check_stdout = config. parse_check_stdout ( ln) ;
436
+ }
439
437
440
- if !self . dont_check_compiler_stdout {
441
- self . dont_check_compiler_stdout = config. parse_dont_check_compiler_stdout ( ln) ;
442
- }
438
+ if !self . check_run_results {
439
+ self . check_run_results = config. parse_check_run_results ( ln) ;
440
+ }
443
441
444
- if !self . dont_check_compiler_stderr {
445
- self . dont_check_compiler_stderr = config. parse_dont_check_compiler_stderr ( ln) ;
446
- }
442
+ if !self . dont_check_compiler_stdout {
443
+ self . dont_check_compiler_stdout = config. parse_dont_check_compiler_stdout ( ln) ;
444
+ }
447
445
448
- if !self . no_prefer_dynamic {
449
- self . no_prefer_dynamic = config. parse_no_prefer_dynamic ( ln) ;
450
- }
446
+ if !self . dont_check_compiler_stderr {
447
+ self . dont_check_compiler_stderr = config. parse_dont_check_compiler_stderr ( ln) ;
448
+ }
451
449
452
- if !self . pretty_expanded {
453
- self . pretty_expanded = config. parse_pretty_expanded ( ln) ;
454
- }
450
+ if !self . no_prefer_dynamic {
451
+ self . no_prefer_dynamic = config. parse_no_prefer_dynamic ( ln) ;
452
+ }
455
453
456
- if let Some ( m ) = config . parse_pretty_mode ( ln ) {
457
- self . pretty_mode = m ;
458
- }
454
+ if ! self . pretty_expanded {
455
+ self . pretty_expanded = config . parse_pretty_expanded ( ln ) ;
456
+ }
459
457
460
- if ! self . pretty_compare_only {
461
- self . pretty_compare_only = config . parse_pretty_compare_only ( ln ) ;
462
- }
458
+ if let Some ( m ) = config . parse_pretty_mode ( ln ) {
459
+ self . pretty_mode = m ;
460
+ }
463
461
464
- if let Some ( ab ) = config . parse_aux_build ( ln ) {
465
- self . aux_builds . push ( ab ) ;
466
- }
462
+ if ! self . pretty_compare_only {
463
+ self . pretty_compare_only = config . parse_pretty_compare_only ( ln ) ;
464
+ }
467
465
468
- if let Some ( ac ) = config. parse_aux_crate ( ln) {
469
- self . aux_crates . push ( ac ) ;
470
- }
466
+ if let Some ( ab ) = config. parse_aux_build ( ln) {
467
+ self . aux_builds . push ( ab ) ;
468
+ }
471
469
472
- if let Some ( ee ) = config. parse_env ( ln, "exec-env" ) {
473
- self . exec_env . push ( ee ) ;
474
- }
470
+ if let Some ( ac ) = config. parse_aux_crate ( ln) {
471
+ self . aux_crates . push ( ac ) ;
472
+ }
475
473
476
- if let Some ( ee) = config. parse_env ( ln, "rustc -env" ) {
477
- self . rustc_env . push ( ee) ;
478
- }
474
+ if let Some ( ee) = config. parse_env ( ln, "exec -env" ) {
475
+ self . exec_env . push ( ee) ;
476
+ }
479
477
480
- if let Some ( ev ) = config. parse_name_value_directive ( ln, "unset- rustc-env" ) {
481
- self . unset_rustc_env . push ( ev ) ;
482
- }
478
+ if let Some ( ee ) = config. parse_env ( ln, "rustc-env" ) {
479
+ self . rustc_env . push ( ee ) ;
480
+ }
483
481
484
- if let Some ( cl ) = config. parse_check_line ( ln) {
485
- self . check_lines . push ( cl ) ;
486
- }
482
+ if let Some ( ev ) = config. parse_name_value_directive ( ln, "unset-rustc-env" ) {
483
+ self . unset_rustc_env . push ( ev ) ;
484
+ }
487
485
488
- if let Some ( of ) = config. parse_forbid_output ( ln) {
489
- self . forbid_output . push ( of ) ;
490
- }
486
+ if let Some ( cl ) = config. parse_check_line ( ln) {
487
+ self . check_lines . push ( cl ) ;
488
+ }
491
489
492
- if ! self . check_test_line_numbers_match {
493
- self . check_test_line_numbers_match = config . parse_check_test_line_numbers_match ( ln ) ;
494
- }
490
+ if let Some ( of ) = config . parse_forbid_output ( ln ) {
491
+ self . forbid_output . push ( of ) ;
492
+ }
495
493
496
- self . update_pass_mode ( ln, cfg, config) ;
497
- self . update_fail_mode ( ln, config) ;
494
+ if !self . check_test_line_numbers_match {
495
+ self . check_test_line_numbers_match =
496
+ config. parse_check_test_line_numbers_match ( ln) ;
497
+ }
498
498
499
- if !self . ignore_pass {
500
- self . ignore_pass = config. parse_ignore_pass ( ln) ;
501
- }
499
+ self . update_pass_mode ( ln, cfg, config) ;
500
+ self . update_fail_mode ( ln, config) ;
502
501
503
- if let Some ( rule) = config. parse_custom_normalization ( ln, "normalize-stdout" ) {
504
- self . normalize_stdout . push ( rule) ;
505
- }
506
- if let Some ( rule) = config. parse_custom_normalization ( ln, "normalize-stderr" ) {
507
- self . normalize_stderr . push ( rule) ;
508
- }
502
+ if !self . ignore_pass {
503
+ self . ignore_pass = config. parse_ignore_pass ( ln) ;
504
+ }
509
505
510
- if let Some ( code) = config. parse_failure_status ( ln) {
511
- self . failure_status = code;
512
- }
506
+ if let Some ( rule) = config. parse_custom_normalization ( ln, "normalize-stdout" ) {
507
+ self . normalize_stdout . push ( rule) ;
508
+ }
509
+ if let Some ( rule) = config. parse_custom_normalization ( ln, "normalize-stderr" ) {
510
+ self . normalize_stderr . push ( rule) ;
511
+ }
513
512
514
- if ! self . run_rustfix {
515
- self . run_rustfix = config . parse_run_rustfix ( ln ) ;
516
- }
513
+ if let Some ( code ) = config . parse_failure_status ( ln ) {
514
+ self . failure_status = code ;
515
+ }
517
516
518
- if !self . rustfix_only_machine_applicable {
519
- self . rustfix_only_machine_applicable =
520
- config. parse_rustfix_only_machine_applicable ( ln) ;
521
- }
517
+ if !self . run_rustfix {
518
+ self . run_rustfix = config. parse_run_rustfix ( ln) ;
519
+ }
522
520
523
- if self . assembly_output . is_none ( ) {
524
- self . assembly_output = config. parse_assembly_output ( ln) ;
525
- }
526
- } ) ;
521
+ if !self . rustfix_only_machine_applicable {
522
+ self . rustfix_only_machine_applicable =
523
+ config. parse_rustfix_only_machine_applicable ( ln) ;
524
+ }
525
+
526
+ if self . assembly_output . is_none ( ) {
527
+ self . assembly_output = config. parse_assembly_output ( ln) ;
528
+ }
529
+ } ) ;
530
+ }
527
531
528
532
if self . failure_status == -1 {
529
533
self . failure_status = match config. mode {
0 commit comments