OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 test_port = host.port_factory.get('test-win-xp', None) | 513 test_port = host.port_factory.get('test-win-xp', None) |
514 test_port.test_exists = lambda test: True | 514 test_port.test_exists = lambda test: True |
515 test_port.test_isfile = lambda test: True | 515 test_port.test_isfile = lambda test: True |
516 | 516 |
517 test_config = test_port.test_configuration() | 517 test_config = test_port.test_configuration() |
518 test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Linux
Win Release ] failures/expected/foo.html [ Failure ] | 518 test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Linux
Win Release ] failures/expected/foo.html [ Failure ] |
519 Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ] | 519 Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ] |
520 """} | 520 """} |
521 expectations = TestExpectations(test_port, self.get_basic_tests()) | 521 expectations = TestExpectations(test_port, self.get_basic_tests()) |
522 | 522 |
523 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 523 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
524 | 524 |
525 self.assertEqual("""Bug(x) [ Linux Win7 Release ] failures/expected/foo.
html [ Failure ] | 525 self.assertEqual("""Bug(x) [ Linux Win7 Release ] failures/expected/foo.
html [ Failure ] |
526 Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ] | 526 Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ] |
527 """, actual_expectations) | 527 """, actual_expectations) |
528 | 528 |
529 def test_remove_needs_rebaseline(self): | 529 def test_remove_needs_rebaseline(self): |
530 host = MockHost() | 530 host = MockHost() |
531 test_port = host.port_factory.get('test-win-xp', None) | 531 test_port = host.port_factory.get('test-win-xp', None) |
532 test_port.test_exists = lambda test: True | 532 test_port.test_exists = lambda test: True |
533 test_port.test_isfile = lambda test: True | 533 test_port.test_isfile = lambda test: True |
534 | 534 |
535 test_config = test_port.test_configuration() | 535 test_config = test_port.test_configuration() |
536 test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Win ]
failures/expected/foo.html [ NeedsRebaseline ] | 536 test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Win ]
failures/expected/foo.html [ NeedsRebaseline ] |
537 """} | 537 """} |
538 expectations = TestExpectations(test_port, self.get_basic_tests()) | 538 expectations = TestExpectations(test_port, self.get_basic_tests()) |
539 | 539 |
540 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 540 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
541 | 541 |
542 self.assertEqual("""Bug(x) [ XP Debug ] failures/expected/foo.html [ Nee
dsRebaseline ] | 542 self.assertEqual("""Bug(x) [ XP Debug ] failures/expected/foo.html [ Nee
dsRebaseline ] |
543 Bug(x) [ Win7 ] failures/expected/foo.html [ NeedsRebaseline ] | 543 Bug(x) [ Win7 ] failures/expected/foo.html [ NeedsRebaseline ] |
544 """, actual_expectations) | 544 """, actual_expectations) |
545 | 545 |
| 546 def test_remove_multiple_configurations(self): |
| 547 host = MockHost() |
| 548 test_port = host.port_factory.get('test-win-xp', None) |
| 549 test_port.test_exists = lambda test: True |
| 550 test_port.test_isfile = lambda test: True |
| 551 |
| 552 test_config = test_port.test_configuration() |
| 553 test_port.expectations_dict = lambda: {'expectations': """Bug(y) [ Win D
ebug ] failures/expected/foo.html [ Crash ] |
| 554 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] |
| 555 """} |
| 556 expectations = TestExpectations(test_port) |
| 557 |
| 558 actual_expectations = expectations.remove_configurations([ |
| 559 ('failures/expected/foo.html', test_config), |
| 560 ('failures/expected/foo.html', host.port_factory.get('test-win-win7'
, None).test_configuration()), |
| 561 ]) |
| 562 |
| 563 self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Cr
ash ] |
| 564 """, actual_expectations) |
| 565 |
546 def test_remove_line_with_comments(self): | 566 def test_remove_line_with_comments(self): |
547 host = MockHost() | 567 host = MockHost() |
548 test_port = host.port_factory.get('test-win-xp', None) | 568 test_port = host.port_factory.get('test-win-xp', None) |
549 test_port.test_exists = lambda test: True | 569 test_port.test_exists = lambda test: True |
550 test_port.test_isfile = lambda test: True | 570 test_port.test_isfile = lambda test: True |
551 | 571 |
552 test_config = test_port.test_configuration() | 572 test_config = test_port.test_configuration() |
553 test_port.expectations_dict = lambda: {'expectations': """Bug(y) [ Win D
ebug ] failures/expected/foo.html [ Crash ] | 573 test_port.expectations_dict = lambda: {'expectations': """Bug(y) [ Win D
ebug ] failures/expected/foo.html [ Crash ] |
554 | 574 |
555 # This comment line should get stripped. As should the preceding line. | 575 # This comment line should get stripped. As should the preceding line. |
556 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] | 576 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] |
557 """} | 577 """} |
558 expectations = TestExpectations(test_port) | 578 expectations = TestExpectations(test_port) |
559 | 579 |
560 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 580 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
561 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 581 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
562 | 582 |
563 self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Cr
ash ] | 583 self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Cr
ash ] |
564 """, actual_expectations) | 584 """, actual_expectations) |
565 | 585 |
566 def test_remove_line_with_comments_at_start(self): | 586 def test_remove_line_with_comments_at_start(self): |
567 host = MockHost() | 587 host = MockHost() |
568 test_port = host.port_factory.get('test-win-xp', None) | 588 test_port = host.port_factory.get('test-win-xp', None) |
569 test_port.test_exists = lambda test: True | 589 test_port.test_exists = lambda test: True |
570 test_port.test_isfile = lambda test: True | 590 test_port.test_isfile = lambda test: True |
571 | 591 |
572 test_config = test_port.test_configuration() | 592 test_config = test_port.test_configuration() |
573 test_port.expectations_dict = lambda: {'expectations': """ | 593 test_port.expectations_dict = lambda: {'expectations': """ |
574 # This comment line should get stripped. As should the preceding line. | 594 # This comment line should get stripped. As should the preceding line. |
575 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] | 595 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] |
576 | 596 |
577 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 597 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
578 """} | 598 """} |
579 expectations = TestExpectations(test_port) | 599 expectations = TestExpectations(test_port) |
580 | 600 |
581 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 601 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
582 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 602 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
583 | 603 |
584 self.assertEqual(""" | 604 self.assertEqual(""" |
585 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 605 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
586 """, actual_expectations) | 606 """, actual_expectations) |
587 | 607 |
588 def test_remove_line_with_comments_at_end_with_no_trailing_newline(self): | 608 def test_remove_line_with_comments_at_end_with_no_trailing_newline(self): |
589 host = MockHost() | 609 host = MockHost() |
590 test_port = host.port_factory.get('test-win-xp', None) | 610 test_port = host.port_factory.get('test-win-xp', None) |
591 test_port.test_exists = lambda test: True | 611 test_port.test_exists = lambda test: True |
592 test_port.test_isfile = lambda test: True | 612 test_port.test_isfile = lambda test: True |
593 | 613 |
594 test_config = test_port.test_configuration() | 614 test_config = test_port.test_configuration() |
595 test_port.expectations_dict = lambda: {'expectations': """Bug(y) [ Win D
ebug ] failures/expected/foo.html [ Crash ] | 615 test_port.expectations_dict = lambda: {'expectations': """Bug(y) [ Win D
ebug ] failures/expected/foo.html [ Crash ] |
596 | 616 |
597 # This comment line should get stripped. As should the preceding line. | 617 # This comment line should get stripped. As should the preceding line. |
598 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ]"""} | 618 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ]"""} |
599 expectations = TestExpectations(test_port) | 619 expectations = TestExpectations(test_port) |
600 | 620 |
601 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 621 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
602 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 622 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
603 | 623 |
604 self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Cr
ash ]""", actual_expectations) | 624 self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Cr
ash ]""", actual_expectations) |
605 | 625 |
606 def test_remove_line_leaves_comments_for_next_line(self): | 626 def test_remove_line_leaves_comments_for_next_line(self): |
607 host = MockHost() | 627 host = MockHost() |
608 test_port = host.port_factory.get('test-win-xp', None) | 628 test_port = host.port_factory.get('test-win-xp', None) |
609 test_port.test_exists = lambda test: True | 629 test_port.test_exists = lambda test: True |
610 test_port.test_isfile = lambda test: True | 630 test_port.test_isfile = lambda test: True |
611 | 631 |
612 test_config = test_port.test_configuration() | 632 test_config = test_port.test_configuration() |
613 test_port.expectations_dict = lambda: {'expectations': """ | 633 test_port.expectations_dict = lambda: {'expectations': """ |
614 # This comment line should not get stripped. | 634 # This comment line should not get stripped. |
615 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] | 635 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] |
616 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 636 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
617 """} | 637 """} |
618 expectations = TestExpectations(test_port) | 638 expectations = TestExpectations(test_port) |
619 | 639 |
620 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 640 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
621 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 641 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
622 | 642 |
623 self.assertEqual(""" | 643 self.assertEqual(""" |
624 # This comment line should not get stripped. | 644 # This comment line should not get stripped. |
625 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 645 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
626 """, actual_expectations) | 646 """, actual_expectations) |
627 | 647 |
628 def test_remove_line_no_whitespace_lines(self): | 648 def test_remove_line_no_whitespace_lines(self): |
629 host = MockHost() | 649 host = MockHost() |
630 test_port = host.port_factory.get('test-win-xp', None) | 650 test_port = host.port_factory.get('test-win-xp', None) |
631 test_port.test_exists = lambda test: True | 651 test_port.test_exists = lambda test: True |
632 test_port.test_isfile = lambda test: True | 652 test_port.test_isfile = lambda test: True |
633 | 653 |
634 test_config = test_port.test_configuration() | 654 test_config = test_port.test_configuration() |
635 test_port.expectations_dict = lambda: {'expectations': """ | 655 test_port.expectations_dict = lambda: {'expectations': """ |
636 # This comment line should get stripped. | 656 # This comment line should get stripped. |
637 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] | 657 Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ] |
638 # This comment line should not get stripped. | 658 # This comment line should not get stripped. |
639 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 659 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
640 """} | 660 """} |
641 expectations = TestExpectations(test_port) | 661 expectations = TestExpectations(test_port) |
642 | 662 |
643 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 663 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
644 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 664 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
645 | 665 |
646 self.assertEqual(""" # This comment line should not get stripped. | 666 self.assertEqual(""" # This comment line should not get stripped. |
647 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 667 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
648 """, actual_expectations) | 668 """, actual_expectations) |
649 | 669 |
650 def test_remove_first_line(self): | 670 def test_remove_first_line(self): |
651 host = MockHost() | 671 host = MockHost() |
652 test_port = host.port_factory.get('test-win-xp', None) | 672 test_port = host.port_factory.get('test-win-xp', None) |
653 test_port.test_exists = lambda test: True | 673 test_port.test_exists = lambda test: True |
654 test_port.test_isfile = lambda test: True | 674 test_port.test_isfile = lambda test: True |
655 | 675 |
656 test_config = test_port.test_configuration() | 676 test_config = test_port.test_configuration() |
657 test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Win R
elease ] failures/expected/foo.html [ Failure ] | 677 test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Win R
elease ] failures/expected/foo.html [ Failure ] |
658 # This comment line should not get stripped. | 678 # This comment line should not get stripped. |
659 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 679 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
660 """} | 680 """} |
661 expectations = TestExpectations(test_port) | 681 expectations = TestExpectations(test_port) |
662 | 682 |
663 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 683 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
664 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 684 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
665 | 685 |
666 self.assertEqual(""" # This comment line should not get stripped. | 686 self.assertEqual(""" # This comment line should not get stripped. |
667 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] | 687 Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ] |
668 """, actual_expectations) | 688 """, actual_expectations) |
669 | 689 |
670 def test_remove_flaky_line(self): | 690 def test_remove_flaky_line(self): |
671 host = MockHost() | 691 host = MockHost() |
672 test_port = host.port_factory.get('test-win-xp', None) | 692 test_port = host.port_factory.get('test-win-xp', None) |
673 test_port.test_exists = lambda test: True | 693 test_port.test_exists = lambda test: True |
674 test_port.test_isfile = lambda test: True | 694 test_port.test_isfile = lambda test: True |
675 | 695 |
676 test_config = test_port.test_configuration() | 696 test_config = test_port.test_configuration() |
677 test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Win ]
failures/expected/foo.html [ Failure Timeout ] | 697 test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Win ]
failures/expected/foo.html [ Failure Timeout ] |
678 Bug(y) [ Mac ] failures/expected/foo.html [ Crash ] | 698 Bug(y) [ Mac ] failures/expected/foo.html [ Crash ] |
679 """} | 699 """} |
680 expectations = TestExpectations(test_port) | 700 expectations = TestExpectations(test_port) |
681 | 701 |
682 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', test_config) | 702 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', test_config)]) |
683 actual_expectations = expectations.remove_configuration_from_test('failu
res/expected/foo.html', host.port_factory.get('test-win-win7', None).test_config
uration()) | 703 actual_expectations = expectations.remove_configurations([('failures/exp
ected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration
())]) |
684 | 704 |
685 self.assertEqual("""Bug(x) [ Win Debug ] failures/expected/foo.html [ Fa
ilure Timeout ] | 705 self.assertEqual("""Bug(x) [ Win Debug ] failures/expected/foo.html [ Fa
ilure Timeout ] |
686 Bug(y) [ Mac ] failures/expected/foo.html [ Crash ] | 706 Bug(y) [ Mac ] failures/expected/foo.html [ Crash ] |
687 """, actual_expectations) | 707 """, actual_expectations) |
688 | 708 |
689 | 709 |
690 class RebaseliningTest(Base): | 710 class RebaseliningTest(Base): |
691 def test_get_rebaselining_failures(self): | 711 def test_get_rebaselining_failures(self): |
692 # Make sure we find a test as needing a rebaseline even if it is not mar
ked as a failure. | 712 # Make sure we find a test as needing a rebaseline even if it is not mar
ked as a failure. |
693 self.parse_exp('Bug(x) failures/expected/text.html [ Rebaseline ]\n') | 713 self.parse_exp('Bug(x) failures/expected/text.html [ Rebaseline ]\n') |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 889 |
870 def disabled_test_string_whitespace_stripping(self): | 890 def disabled_test_string_whitespace_stripping(self): |
871 # FIXME: Re-enable this test once we rework the code to no longer suppor
t the old syntax. | 891 # FIXME: Re-enable this test once we rework the code to no longer suppor
t the old syntax. |
872 self.assert_round_trip('\n', '') | 892 self.assert_round_trip('\n', '') |
873 self.assert_round_trip(' [ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') | 893 self.assert_round_trip(' [ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') |
874 self.assert_round_trip('[ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') | 894 self.assert_round_trip('[ FOO ] bar [ BAZ ]', '[ FOO ] bar [ BAZ ]') |
875 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar
[ BAZ ] # Qux.') | 895 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] bar
[ BAZ ] # Qux.') |
876 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] ba
r [ BAZ ] # Qux.') | 896 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ] ba
r [ BAZ ] # Qux.') |
877 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ]
bar [ BAZ ] # Qux.') | 897 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FOO ]
bar [ BAZ ] # Qux.') |
878 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FO
O ] bar [ BAZ ] # Qux.') | 898 self.assert_round_trip('[ FOO ] bar [ BAZ ] # Qux.', '[ FO
O ] bar [ BAZ ] # Qux.') |
OLD | NEW |