Changeset 514 for yum/vendor/current/test/skipbroken-tests.py
- Timestamp:
- Feb 3, 2015, 8:28:05 AM (11 years ago)
- File:
-
- 1 edited
-
yum/vendor/current/test/skipbroken-tests.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yum/vendor/current/test/skipbroken-tests.py
r2 r514 2 2 import logging 3 3 import sys 4 import re 4 5 from testbase import * 6 7 REGEX_PKG = re.compile(r"(\d*):?(.*)-(.*)-(.*)\.(.*)$") 5 8 6 9 class SkipBrokenTests(DepsolveTests): … … 21 24 self.rpmdb.addPackage(po) 22 25 return po 26 27 def _pkgstr_to_nevra(self, pkg_str): 28 ''' 29 Get a nevra from from a epoch:name-version-release.arch string 30 @param pkg_str: package string 31 ''' 32 res = REGEX_PKG.search(pkg_str) 33 if res: 34 (e,n,v,r,a) = res.groups() 35 if e == "": 36 e = "0" 37 return (n,e,v,r,a) 38 else: 39 raise AttributeError("Illegal package string : %s" % pkg_str) 40 41 def repoString(self, pkg_str): 42 ''' 43 Add an available package from a epoch:name-version-release.arch string 44 ''' 45 (n,e,v,r,a) = self._pkgstr_to_nevra(pkg_str) 46 return self.repoPackage(n,v,r,e,a) 47 48 49 def instString(self, pkg_str): 50 ''' 51 Add an installed package from a epoch:name-version-release.arch string 52 ''' 53 (n,e,v,r,a) = self._pkgstr_to_nevra(pkg_str) 54 return self.instPackage(n,v,r,e,a) 55 23 56 24 57 def testMissingReqNoSkip(self): … … 599 632 self.assertEquals('empty', *self.resolveCode(skip=True)) 600 633 self.assertResult([i1,i2]) 601 634 635 def testDowngrade1(self): 636 ''' 637 bar require foolib=2.0 provided by foo-1.2 638 foo-1.2 is downgraded to foo-1.1 there only contains foolib=1.0 639 so bar requirement is broken and the downgrade should be removed from 640 transaction 641 ''' 642 i1 = self.instPackage('foo', '1.2') 643 i1.addProvides('foolib', 'EQ', ('0', '2', '0')) 644 i2 = self.instPackage('bar', '1.0') 645 i2.addRequires('foolib', 'EQ', ('0', '2', '0')) 646 d1 = self.repoPackage('foo', '1.1') 647 d1.addProvides('foolib', 'EQ', ('0', '1', '0')) 648 self.tsInfo.addDowngrade(d1, oldpo=i1) 649 self.assertEquals('empty', *self.resolveCode(skip=True)) 650 self.assertResult([i1, i2]) 651 602 652 603 653 def testMissingfileReqIptabes(self): … … 622 672 self.assertEquals('empty', *self.resolveCode(skip=True)) 623 673 self.assertResult([i1,i2]) 624 674 675 def testTransactionOutput(self): 676 ''' 677 Test that skip-broken transaction dump output dont show the 678 dependon: xxx once. 679 ''' 680 i1 = self.repoPackage('bar1', '1') 681 i1.addRequires('foo1', 'EQ', ('0', '1', '0')) 682 i1.addRequires('foo2', 'EQ', ('0', '1', '0')) 683 i1.addRequires('foo3', 'EQ', ('0', '1', '0')) 684 i1.addRequires('foo4', 'EQ', ('0', '1', '0')) 685 i1.addRequires('foo5', 'EQ', ('0', '1', '0')) 686 i1.addRequires('foo6', 'EQ', ('0', '1', '0')) 687 i2 = self.repoPackage('fooA', '1') 688 i2.addProvides('foo1', 'EQ', ('0', '1', '0')) 689 i3 = self.repoPackage('fooB', '1') 690 i3.addProvides('foo2', 'EQ', ('0', '1', '0')) 691 i4 = self.repoPackage('fooC', '1') 692 i4.addProvides('foo3', 'EQ', ('0', '1', '0')) 693 i5 = self.repoPackage('fooD', '1') 694 i5.addProvides('foo4', 'EQ', ('0', '1', '0')) 695 i6 = self.repoPackage('fooE', '1') 696 i6.addProvides('foo5', 'EQ', ('0', '1', '0')) 697 i7 = self.instPackage('fooF', '1') 698 i7.addProvides('foo6', 'EQ', ('0', '1', '0')) 699 u7 = self.instPackage('fooF', '2') 700 u7.addProvides('foo6', 'EQ', ('0', '2', '0')) 701 self.tsInfo.addInstall(i1) 702 self.tsInfo.addUpdate(u7, oldpo=i7) 703 self.assertEquals('ok', *self.resolveCode(skip=True)) 704 # uncomment this line and the test will fail and you can see the output 705 # self.assertResult([i1]) 706 707 def test_conflict_looping(self): 708 ''' 709 Skip-broken is looping 710 https://bugzilla.redhat.com/show_bug.cgi?id=681806 711 ''' 712 members = [] # the result after the transaction 713 # Installed package conflicts with u1 714 i0 = self.instString('kde-l10n-4.6.0-3.fc15.1.noarch') 715 i0.addConflicts('kdepim', 'GT', ('6', '4.5.9', '0')) 716 members.append(i0) 717 i1 = self.instString('6:kdepim-4.5.94.1-1.fc14.x86_64') 718 u1 = self.repoString('7:kdepim-4.4.10-1.fc15.x86_64') 719 self.tsInfo.addUpdate(u1, oldpo=i1) 720 # u1 should be removed, because of the conflict 721 members.append(i1) 722 i2 = self.instString('6:kdepim-libs-4.5.94.1-1.fc14.x86_64') 723 u2 = self.repoString('7:kdepim-libs-4.4.10-1.fc15.x86_64') 724 self.tsInfo.addUpdate(u2, oldpo=i2) 725 members.append(u2) 726 i3 = self.instString('kdepim-runtime-libs-4.5.94.1-2.fc14.x86_64') 727 u3 = self.repoString('1:kdepim-runtime-libs-4.4.10-2.fc15.x86_64') 728 self.tsInfo.addUpdate(u3, oldpo=i3) 729 members.append(u3) 730 i4 = self.instString('kdepim-runtime-4.5.94.1-2.fc14.x86_64') 731 u4 = self.repoString('1:kdepim-runtime-4.4.10-2.fc15.x86_64') 732 self.tsInfo.addUpdate(u4, oldpo=i4) 733 members.append(u4) 734 self.assertEquals('ok', *self.resolveCode(skip=True)) 735 self.assertResult(members) 736 737 def test_skipbroken_001(self): 738 ''' 739 this will pass 740 https://bugzilla.redhat.com/show_bug.cgi?id=656057 741 ''' 742 members = [] 743 # Installed package conflicts with ux1 744 ix0 = self.instString('1:libguestfs-1.6.0-1.fc14.1.i686') 745 ix0.addRequires('/usr/lib/.libssl.so.1.0.0a.hmac') 746 members.append(ix0) 747 ix1 = self.instString('openssl-1.0.0a-2.fc14.i686') 748 ix1.addFile("/usr/lib/.libssl.so.1.0.0a.hmac") 749 ux1 = self.repoString('openssl-1.0.0b-1.fc14.i686') 750 ux1.addFile("/usr/lib/.libssl.so.1.0.0b.hmac") 751 self.tsInfo.addUpdate(ux1, oldpo=ix1) 752 members.append(ix1) 753 self.assertEquals('empty', *self.resolveCode(skip=True)) 754 self.assertResult(members) 755 756 757 def test_skipbroken_002(self): 758 ''' 759 this will pass 760 https://bugzilla.redhat.com/show_bug.cgi?id=656057 761 ''' 762 members = [] 763 # Installed package conflicts with ux1 764 ix0 = self.instString('1:libguestfs-1.6.0-1.fc14.1.i686') 765 ix0.addRequires('/usr/lib/.libssl.so.1.0.0a.hmac') 766 members.append(ix0) 767 ix1 = self.instString('openssl-1.0.0a-2.fc14.i686') 768 ix1.addFile("/usr/lib/.libssl.so.1.0.0a.hmac") 769 ux1 = self.repoString('openssl-1.0.0b-1.fc14.i686') 770 ux1.addFile("/usr/lib/.libssl.so.1.0.0b.hmac") 771 self.tsInfo.addUpdate(ux1, oldpo=ix1) 772 members.append(ix1) 773 # this is just junk to make the transaction big 774 i1 = self.instString('afoobar-0.4.12-2.fc12.noarch') 775 u1 = self.repoString('afoobar-0.4.14-1.fc14.noarch') 776 self.tsInfo.addUpdate(u1, oldpo=i1) 777 members.append(u1) 778 self.assertEquals('ok', *self.resolveCode(skip=True)) 779 self.assertResult(members) 780 781 def test_skipbroken_003(self): 782 ''' 783 this will fail, because of a bug in the skip-broken code. 784 it will remove the wrong package (zfoobar) instead of openssl. 785 the problem is that self._working_po is not set with the right value 786 when checking file requires for installed packages after the transaction 787 if resolved. (_resolveRequires) 788 if fails because self._working_po contains the last package processed in the transaction 789 zfoobar, so it will be removed. 790 https://bugzilla.redhat.com/show_bug.cgi?id=656057 791 792 This should not fail anymore, after the the self._working_po is reset in depsolver 793 ''' 794 members = [] 795 # Installed package conflicts with ux1 796 ix0 = self.instString('1:libguestfs-1.6.0-1.fc14.1.i686') 797 ix0.addRequires('/usr/lib/.libssl.so.1.0.0a.hmac') 798 members.append(ix0) 799 ix1 = self.instString('openssl-1.0.0a-2.fc14.i686') 800 ix1.addFile("/usr/lib/.libssl.so.1.0.0a.hmac") 801 ux1 = self.repoString('openssl-1.0.0b-1.fc14.i686') 802 ux1.addFile("/usr/lib/.libssl.so.1.0.0b.hmac") 803 self.tsInfo.addUpdate(ux1, oldpo=ix1) 804 members.append(ix1) 805 # this is just junk to make the transaction big 806 i1 = self.instString('zfoobar-0.4.12-2.fc12.noarch') 807 u1 = self.repoString('zfoobar-0.4.14-1.fc14.noarch') 808 self.tsInfo.addUpdate(u1, oldpo=i1) 809 members.append(u1) 810 self.assertEquals('ok', *self.resolveCode(skip=True)) 811 self.assertResult(members) 625 812 626 813 627 814 def resolveCode(self,skip = False): 628 815 solver = YumBase() 816 solver.save_ts = save_ts 629 817 solver.arch.setup_arch('x86_64') 630 818 solver.conf = FakeConf()
Note:
See TracChangeset
for help on using the changeset viewer.
