Bug#872826: Diffoscope: difference of "Device ID" caused an error in test suite on FreeBSD

Ximin Luo infinity0 at debian.org
Mon Aug 21 16:11:00 UTC 2017


Source: diffoscope
Version: 85
Severity: normal
X-Debbugs-CC: yzgyyang at outlook.com
 
A test case failed on FreeBSD because of the different Device ID between two system.
 
A commit regarding a similar issue: https://anonscm.debian.org/git/reproducible/diffoscope.git/commit/?id=1390b76
 
A proposed patch is attached. Thank you!

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
-------------- next part --------------
diff --git a/tests/comparators/test_git.py b/tests/comparators/test_git.py
index c2b1247..d32e4ce 100644
--- a/tests/comparators/test_git.py
+++ b/tests/comparators/test_git.py
@@ -17,6 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
+import os
 import pytest
 
 from diffoscope.comparators.git import GitIndexFile
@@ -38,5 +39,8 @@ def differences(git1, git2):
     return git1.compare(git2).details
 
 def test_diff(differences):
-    expected_diff = get_data('git_expected_diff')
+    if os.uname()[0] == 'FreeBSD':
+        expected_diff = get_data('git_expected_diff_freebsd')
+    else:
+        expected_diff = get_data('git_expected_diff')
     assert differences[0].unified_diff == expected_diff
diff --git a/tests/data/git_expected_diff_freebsd b/tests/data/git_expected_diff_freebsd
new file mode 100644
index 0000000..f357a2d
--- /dev/null
+++ b/tests/data/git_expected_diff_freebsd
@@ -0,0 +1,19 @@
+@@ -10,7 +10,18 @@
+ User ID:   1000
+ Group ID:  1000
+ Created:   1471689380.154572964
+ Modified:  1471689380.154572964
+ Inode:     52205983
+ Device ID: (0, 2054)
+ 
++Path:      b'b'
++SHA:       e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
++Size:      0
++Flags:     0b1
++User ID:   1000
++Group ID:  1000
++Created:   1471689417.184218147
++Modified:  1471689417.184218147
++Inode:     52206041
++Device ID: (0, 2054)
++


More information about the Reproducible-builds mailing list