[diffoscope] 04/05: tests: Test RPM "fallback" comparison.
Chris Lamb
chris at chris-lamb.co.uk
Sat Feb 4 03:45:27 CET 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit 3a4d365f91cea7e4f56b0764d9e6c05c32578c9a
Author: Chris Lamb <lamby at debian.org>
Date: Sat Feb 4 15:28:34 2017 +1300
tests: Test RPM "fallback" comparison.
Signed-off-by: Chris Lamb <lamby at debian.org>
---
tests/comparators/test_rpm.py | 17 ++++-
tests/data/rpm_fallback_expected_diff | 115 ++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 3 deletions(-)
diff --git a/tests/comparators/test_rpm.py b/tests/comparators/test_rpm.py
index 33618a8..0cb538a 100644
--- a/tests/comparators/test_rpm.py
+++ b/tests/comparators/test_rpm.py
@@ -20,8 +20,10 @@
import pytest
from diffoscope.comparators import ComparatorManager
+from diffoscope.comparators.binary import FilesystemFile
+from diffoscope.comparators.utils.specialize import specialize
-from utils.data import load_fixture, get_data
+from utils.data import load_fixture, data, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing
@@ -76,10 +78,19 @@ def test_content(differences):
def test_compare_non_existing(monkeypatch, rpm1):
assert_non_existing(monkeypatch, rpm1)
-def test_fallback_import(monkeypatch):
- # Ensure that we can at least import the fallback module
+def test_fallback_comparison(monkeypatch):
manager = ComparatorManager()
monkeypatch.setattr(manager, 'COMPARATORS', (
('rpm_fallback.RpmFile',),
))
manager.reload()
+
+ # Re-specialize after reloading our Comparators
+ rpm1 = specialize(FilesystemFile(data('test1.rpm')))
+ rpm2 = specialize(FilesystemFile(data('test2.rpm')))
+
+ assert rpm1.compare(rpm1) is None
+ assert rpm2.compare(rpm2) is None
+
+ expected_diff = get_data('rpm_fallback_expected_diff')
+ assert rpm1.compare(rpm2).unified_diff == expected_diff
diff --git a/tests/data/rpm_fallback_expected_diff b/tests/data/rpm_fallback_expected_diff
new file mode 100644
index 0000000..3c87fd1
--- /dev/null
+++ b/tests/data/rpm_fallback_expected_diff
@@ -0,0 +1,115 @@
+@@ -7,19 +7,19 @@
+ 00000060: 8ead e801 0000 0000 0000 0006 0000 1054 ...............T
+ 00000070: 0000 003e 0000 0007 0000 1044 0000 0010 ...>.......D....
+ 00000080: 0000 010d 0000 0006 0000 0000 0000 0001 ................
+ 00000090: 0000 03e8 0000 0004 0000 002c 0000 0001 ...........,....
+ 000000a0: 0000 03ec 0000 0007 0000 0030 0000 0010 ...........0....
+ 000000b0: 0000 03ef 0000 0004 0000 0040 0000 0001 ........... at ....
+ 000000c0: 0000 03f0 0000 0007 0000 0044 0000 1000 ...........D....
+-000000d0: 3333 3136 3637 3232 3961 6137 6534 6436 331667229aa7e4d6
+-000000e0: 3030 6636 3832 6539 6364 3063 3633 3732 00f682e9cd0c6372
+-000000f0: 6239 3362 3038 3261 0000 0000 0000 062f b93b082a......./
+-00000100: 0616 6011 d2d6 6f84 33d5 0b41 7358 a31d ..`...o.3..AsX..
+-00000110: 0000 02b8 0000 0000 0000 0000 0000 0000 ................
++000000d0: 3237 3830 3031 3562 6437 6264 3336 3539 2780015bd7bd3659
++000000e0: 3439 6430 3565 3239 3631 3866 6138 3333 49d05e29618fa833
++000000f0: 6536 3265 3436 3034 0000 0000 0000 06ba e62e4604........
++00000100: 7466 86e4 4fc6 8a58 36e8 043f 722e 436a tf..O..X6..?r.Cj
++00000110: 0000 0398 0000 0000 0000 0000 0000 0000 ................
+ 00000120: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000130: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000140: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000150: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000160: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000170: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 00000180: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+@@ -320,21 +320,21 @@
+ 000013f0: 0000 0184 0000 0001 0000 0475 0000 0004 ...........u....
+ 00001400: 0000 0188 0000 0001 0000 0476 0000 0008 ...........v....
+ 00001410: 0000 018c 0000 0001 0000 0477 0000 0004 ...........w....
+ 00001420: 0000 0198 0000 0001 0000 0478 0000 0004 ...........x....
+ 00001430: 0000 019c 0000 0001 4300 7465 7374 0030 ........C.test.0
+ 00001440: 0030 0054 6573 7420 7061 636b 6167 6520 .0.Test package
+ 00001450: 666f 7220 6465 6262 696e 6469 6666 0054 for debbindiff.T
+-00001460: 6573 7420 7061 636b 6167 6500 558a ef0b est package.U...
+-00001470: 6c6f 6172 0000 0000 0000 01be 5075 626c loar........Publ
++00001460: 6573 7420 7061 636b 6167 6500 558a ef31 est package.U..1
++00001470: 6c6f 6172 0000 0000 0000 029f 5075 626c loar........Publ
+ 00001480: 6963 0041 7070 6c69 6361 7469 6f6e 732f ic.Applications/
+ 00001490: 5379 7374 656d 006c 696e 7578 0078 3836 System.linux.x86
+-000014a0: 5f36 3400 0000 01be 81a4 0000 558a ef06 _64.........U...
+-000014b0: 3738 3733 6236 3036 3432 3961 3730 3238 7873b606429a7028
+-000014c0: 3464 3633 6630 3637 3465 3637 3837 6263 4d63f0674e6787bc
++000014a0: 5f36 3400 0000 029f 81a4 0000 558a ef2f _64.........U../
++000014b0: 3137 3836 3632 3632 6130 6336 3064 3931 17866262a0c60d91
++000014c0: 3665 3363 6633 3231 3937 3234 6232 6537 6e3cf3219724b2e7
+ 000014d0: 0000 0000 0000 0000 726f 6f74 0072 6f6f ........root.roo
+ 000014e0: 7400 7465 7374 2d30 2d30 2e73 7263 2e72 t.test-0-0.src.r
+ 000014f0: 706d 0000 ffff ffff 7465 7374 0074 6573 pm......test.tes
+ 00001500: 7428 7838 362d 3634 2900 0000 0100 000a t(x86-64).......
+ 00001510: 0100 000a 7270 6d6c 6962 2843 6f6d 7072 ....rpmlib(Compr
+ 00001520: 6573 7365 6446 696c 654e 616d 6573 2900 essedFileNames).
+ 00001530: 7270 6d6c 6962 2850 6179 6c6f 6164 4669 rpmlib(PayloadFi
+@@ -345,30 +345,39 @@
+ 00001580: 302d 3000 0000 0000 7465 7874 002f 6469 0-0.....text./di
+ 00001590: 722f 002d 4f32 202d 6700 6370 696f 0067 r/.-O2 -g.cpio.g
+ 000015a0: 7a69 7000 3900 7838 365f 3634 2d64 6562 zip.9.x86_64-deb
+ 000015b0: 6961 6e2d 6c69 6e75 7800 0000 0000 0000 ian-linux.......
+ 000015c0: 0000 0000 4153 4349 4920 7465 7874 0000 ....ASCII text..
+ 000015d0: 0000 0000 0000 0000 0000 003f 0000 0007 ...........?....
+ 000015e0: ffff fd00 0000 0010 1f8b 0800 0000 0000 ................
+-000015f0: 0203 8d52 cb4e 0331 0cec 79bf c2bd a365 ...R.N.1..y....e
+-00001600: 2bf1 ba22 d103 524f 157c 809b b8c5 525e +.."..RO.|....R^
+-00001610: 4dec aa9f 8fd3 a512 0710 cc65 e38d 339e M..........e..3.
+-00001620: 1979 7a9c 1ea7 d534 e3f2 7d5a e1dd f433 .yz....4..}Z...3
+-00001630: 56f7 f74f 48fb e961 ae76 34fd 0fbb eb61 V..OH..a.v4....a
+-00001640: bcf5 5c6f 85ce b230 6c72 a508 5c9a 46f0 ..\o...0lr..\.F.
+-00001650: 39e4 0a8d 0530 92dc 80cb a991 1312 ad80 9....0..........
+-00001660: 9e0b 37c7 e900 14d8 2e1b 797b 00c4 da62 ..7.......y{...b
+-00001670: f620 144b ae03 27c7 9ebd 2601 1508 b833 . .K..'...&....3
+-00001680: 7a20 99a9 0922 1e12 0206 3e2a 8ef0 2e40 z ..."....>*...@
+-00001690: 89a3 7143 e47e 3859 89f1 068e ca6d 48b9 ..qC.~8Y.....mH.
+-000016a0: 4955 0f74 a6ea 5850 3827 d010 30ba 3c33 IU.t..XP8'..0.<3
+-000016b0: 7383 c48d fba4 0b25 176b 0642 131e 4d53 s......%.k.B..MS
+-000016c0: 9e0d d828 1987 17a3 0454 21e0 aaa6 64f6 ...(.....T!...d.
+-000016d0: ca09 2a95 4a1f 943c 5533 6e3f 4e39 68b1 ..*.J..<U3n?N9h.
+-000016e0: 7164 72cc 2950 6b04 8e43 b826 6486 74d8 qdr.)Pk..C.&d.t.
+-000016f0: eb81 5120 7541 50b0 5aa1 7584 f5d9 5111 ..Q uAP.Z.u...Q.
+-00001700: d21e a365 909d 4372 d6e7 b4b0 47e9 2fcc ...e..Cr....G./.
+-00001710: 45a9 993d a59e 624f 8ad3 e034 14ec be21 E..=..bO...4...!
+-00001720: eff7 ec18 c153 a3da 6f63 0e5d 06f6 80d8 .....S..oc.]....
+-00001730: e268 5fb9 6a1c 87c5 62fa be3b 7fe1 bf7d .h_.j...b..;...}
+-00001740: bfee cedb f6f9 75b3 de2e 97cb be3b 9feb ......u......;..
+-00001750: 9e1c 01b8 0200 00 .......
++000015f0: 0203 8d53 4d6f 1331 10ed d9bf 62d2 0b20 ...SMo.1....b..
++00001600: a5db 4d4b d5c2 2da2 1142 aa04 aaca 0971 ..MK..-..B.....q
++00001610: 98d8 b3e9 48fe aaed 89c2 bf67 9cd0 2a07 ....H......g..*.
++00001620: 109d cb8e ed99 e779 efad c7eb f17a 5c8c .......y.....z\.
++00001630: 87d8 7f6f 16f8 7efc 7b2c aeae 6e90 a68b ...o..~.{,..n...
++00001640: 69bf baf8 308d af8b f573 329c 3b2e e78d i...0....s2.;...
++00001650: 76ed 4463 0936 8590 224c a904 4813 f854 v.Dc.6.."L..H..T
++00001660: 2800 e72a 010a a1ab 1f8d b93b da73 492b (..*.......;.sI+
++00001670: a072 030c d4e6 da1e 2bd9 464d 0aa0 e3cc .r......+.FM....
++00001680: d572 dc00 79d6 c34a 4e1b 8058 6a48 0e1a .r..y..JN..XjH..
++00001690: 859c 8ae1 68d9 b193 d840 1a78 5c2b 3c50 ....h.... at .x\+<P
++000016a0: 3b40 1304 dc44 04f4 fc24 38c0 f706 1439 ;@...D...$8....9
++000016b0: 2836 04ee c956 9718 e6f0 245c 4d4c b515 (6...V....$\ML..
++000016c0: 7140 3b2a 961b 3656 2ae2 3d06 9b0e c85c q@;*..6V*.=....\
++000016d0: 2172 e57e d31e 92b3 1603 e181 b70e b727 !r.~...........'
++000016e0: a057 b5c1 dc2a 24a0 3402 2ea2 931c b872 .W...*$.4......r
++000016f0: 5421 72a1 478a 8e8a 12d7 8d6d f292 f53a T!r.G......m...:
++00001700: d271 9429 50ad 0496 bd7f 5648 0989 9964 .q.)P.....VH...d
++00001710: c3d8 20f6 8120 63d1 8594 0156 3b4b b991 .. .. c....V;K..
++00001720: 7419 5583 642d 92d5 3a2b 991d b6de a12c t.U.d-..:+.....,
++00001730: 7249 ec28 7615 bb52 1c8d 159f b1f3 569f rI.(v..R......V.
++00001740: 26b6 8ce0 a852 e9a7 21f9 3e06 7681 58e5 &....R..!.>.v.X.
++00001750: a87f 7495 3018 737a e4df 2974 e741 7976 ..t.0.sz..)t.Ayv
++00001760: 2e5b f567 2a29 40b7 50a5 abb0 1816 e370 .[.g*)@.P......p
++00001770: 7971 7676 d97f 864f 6ca9 a437 156e 0926 yqvv...Ol..7.n.&
++00001780: 557f 2dd5 ac53 ecb8 ddb0 807e 9fbe fd1a U.-..S.....~....
++00001790: a13d 12ac a2ab bded 734a 9a60 74b0 dab2 .=......sJ.`t...
++000017a0: af73 5015 d137 2a51 0d52 c17e c18f e53a .sP..7*Q.R.~...:
++000017b0: 49fb 691e b4eb 9b94 9c2a bd74 be34 be1b I.i......*.t.4..
++000017c0: ccc9 78fc 36fe 17af adfb e7db 78b8 5f7e ..x.6.......x._~
++000017d0: b95b ddcf 66b3 fe36 7e03 cd77 5eef 9803 .[..f..6~..w^...
++000017e0: 0000 ..
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list