[diffoscope] 01/01: Disable the llvm-dis test if the version is lower than 3.8

Ximin Luo infinity0 at debian.org
Sat Aug 13 16:53:07 CEST 2016


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

infinity0 pushed a commit to branch master
in repository diffoscope.

commit b05ed6a07d3132e38b2399a7c3b524a97358333f
Author: Ximin Luo <infinity0 at debian.org>
Date:   Sat Aug 13 16:52:49 2016 +0200

    Disable the llvm-dis test if the version is lower than 3.8
---
 diffoscope/__init__.py         |  4 ++++
 tests/comparators/conftest.py  | 10 +++++++++-
 tests/comparators/test_rlib.py |  3 ++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/diffoscope/__init__.py b/diffoscope/__init__.py
index b993682..dbb99c5 100644
--- a/diffoscope/__init__.py
+++ b/diffoscope/__init__.py
@@ -113,6 +113,10 @@ class RequiredToolNotFound(Exception):
             'debian': 'llvm',
             'arch': 'llvm',
         },
+        'llvm-config': {
+            'debian': 'llvm',
+            'arch': 'llvm',
+        },
         'llvm-dis': {
             'debian': 'llvm',
             'arch': 'llvm',
diff --git a/tests/comparators/conftest.py b/tests/comparators/conftest.py
index c8939a0..2a833b2 100644
--- a/tests/comparators/conftest.py
+++ b/tests/comparators/conftest.py
@@ -18,18 +18,26 @@
 # along with diffoscope.  If not, see <http://www.gnu.org/licenses/>.
 
 from distutils.spawn import find_executable
+from distutils.version import StrictVersion
 import diffoscope
 import pytest
+import subprocess
 
 @pytest.fixture(autouse=True)
 def set_locale():
-    diffoscope.set_locale()    
+    diffoscope.set_locale()
 
 
 def tool_missing(cmd):
     return find_executable(cmd) is None
 
 
+def tool_older_than(cmdline, min_ver, vcls=StrictVersion):
+    actual_ver = subprocess.check_output(["llvm-config", "--version"]).decode("utf-8").strip()
+    print(actual_ver, min_ver, vcls)
+    return vcls(actual_ver) < vcls(min_ver)
+
+
 # from Jerry Kindall at http://stackoverflow.com/a/7088133
 def try_except(success, failure, *exceptions):
     try:
diff --git a/tests/comparators/test_rlib.py b/tests/comparators/test_rlib.py
index 5e93a20..8e7f3dc 100644
--- a/tests/comparators/test_rlib.py
+++ b/tests/comparators/test_rlib.py
@@ -28,7 +28,7 @@ from diffoscope.comparators.llvm import LlvmBitCodeFile
 from diffoscope.comparators.rust import RustObjectFile
 from diffoscope.comparators.utils import diff_ignore_line_numbers
 from diffoscope.config import Config
-from conftest import tool_missing
+from conftest import tool_missing, tool_older_than
 
 TEST_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.rlib')
 TEST_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.rlib')
@@ -72,6 +72,7 @@ def test_item2_rust_metadata_bin(differences):
     assert differences[2].source2 == 'rust.metadata.bin'
 
 @pytest.mark.skipif(tool_missing('llvm-dis'), reason='missing llvm-dis')
+ at pytest.mark.skipif(tool_older_than(['llvm-config', '--version'], '3.8'), reason='llvm version too low')
 def test_item3_deflate_llvm_bitcode(differences):
     assert differences[3].source1 == 'alloc_system-d16b8f0e.0.bytecode.deflate'
     assert differences[3].source2 == 'alloc_system-d16b8f0e.0.bytecode.deflate'

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


More information about the diffoscope mailing list