[diffoscope] 01/02: tests: iso9660: support isoinfo's output coming from cdrtools' version instead of genisoimage's

Mattia Rizzolo mattia at debian.org
Wed Aug 2 15:21:37 CEST 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit a8832a470caf5a3a60b1ae5e8c9dfa8262749702
Author: Guangyuan Yang <yzgyyang at outlook.com>
Date:   Wed Aug 2 15:18:11 2017 +0200

    tests: iso9660: support isoinfo's output coming from cdrtools' version instead of genisoimage's
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 tests/comparators/test_iso9660.py                   | 20 ++++++++++++++++++--
 tests/data/iso9660_content_expected_diff_cdrtools   |  9 +++++++++
 tests/data/iso9660_rockridge_expected_diff_cdrtools | 10 ++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/tests/comparators/test_iso9660.py b/tests/comparators/test_iso9660.py
index e8d6535..269b9ec 100644
--- a/tests/comparators/test_iso9660.py
+++ b/tests/comparators/test_iso9660.py
@@ -18,6 +18,7 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import pytest
+import subprocess
 
 from diffoscope.config import Config
 from diffoscope.comparators.missing_file import MissingFile
@@ -30,6 +31,15 @@ from ..utils.tools import skip_unless_tools_exist
 iso1 = load_fixture('test1.iso')
 iso2 = load_fixture('test2.iso')
 
+def is_cdrtools():
+    try:
+        if b"Schilling" in subprocess.check_output(['isoinfo', '--version']):
+            return True
+        else:
+            return False
+    except:
+        return None
+
 def test_identification(iso1):
     assert isinstance(iso1, Iso9660File)
 
@@ -43,12 +53,18 @@ def differences(iso1, iso2):
 
 @skip_unless_tools_exist('isoinfo')
 def test_iso9660_content(differences):
-    expected_diff = get_data('iso9660_content_expected_diff')
+    if is_cdrtools():
+        expected_diff = get_data('iso9660_content_expected_diff_cdrtools')
+    else:
+        expected_diff = get_data('iso9660_content_expected_diff')
     assert differences[0].unified_diff == expected_diff
 
 @skip_unless_tools_exist('isoinfo')
 def test_iso9660_rockridge(differences):
-    expected_diff = get_data('iso9660_rockridge_expected_diff')
+    if is_cdrtools():
+        expected_diff = get_data('iso9660_rockridge_expected_diff_cdrtools')
+    else:
+        expected_diff = get_data('iso9660_rockridge_expected_diff')
     assert differences[1].unified_diff == expected_diff
 
 @skip_unless_tools_exist('isoinfo')
diff --git a/tests/data/iso9660_content_expected_diff_cdrtools b/tests/data/iso9660_content_expected_diff_cdrtools
new file mode 100644
index 0000000..030d533
--- /dev/null
+++ b/tests/data/iso9660_content_expected_diff_cdrtools
@@ -0,0 +1,9 @@
+@@ -1,7 +1,7 @@
+ 
+ Directory listing of /
+ dr-xr-xr-x   1    0    0       2048 Jun 24 2015 [     23 02] . 
+ dr-xr-xr-x   1    0    0       2048 Jun 24 2015 [     23 02] .. 
+ -r-xr-xr-x   1    0    0          0 Jun 24 2015 [     25 00] LINK.;1 
+ -r-xr-xr-x   1    0    0          0 Jun 24 2015 [     25 00] NULL.;1 
+--r-xr-xr-x   1    0    0        446 Jun 24 2015 [     25 00] TEXT.;1 
++-r-xr-xr-x   1    0    0        671 Jun 24 2015 [     25 00] TEXT.;1 
diff --git a/tests/data/iso9660_rockridge_expected_diff_cdrtools b/tests/data/iso9660_rockridge_expected_diff_cdrtools
new file mode 100644
index 0000000..2243a49
--- /dev/null
+++ b/tests/data/iso9660_rockridge_expected_diff_cdrtools
@@ -0,0 +1,10 @@
+@@ -1,7 +1,7 @@
+ 
+ Directory listing of /
+ drwxr-xr-x   2 1000 1000       2048 Jun 24 2015 [     23 02] . 
+ drwxr-xr-x   2 1000 1000       2048 Jun 24 2015 [     23 02] .. 
+-lrwxrwxrwx   1 1000 1000          0 Jun 24 2015 [     25 00] link -> broken
++lrwxrwxrwx   1 1000 1000          0 Jun 24 2015 [     25 00] link -> really-broken
+ crw-r--r--   1    0    0          0 Jun 24 2015 [     25 00] null 
+--rw-r--r--   1 1000 1000        446 Jun 24 2015 [     25 00] text 
++-rw-r--r--   1 1000 1000        671 Jun 24 2015 [     25 00] text 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list