[diffoscope] 01/01: tests/comparators: dtb: compatibility with version 1.4.5

Mattia Rizzolo mattia at debian.org
Mon Oct 2 00:27:56 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 8f983042fce633ae46a1c92c14b149018ea0e634
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Mon Oct 2 00:25:52 2017 +0200

    tests/comparators: dtb: compatibility with version 1.4.5
    
    Used to be:
    
    % fdtdump --version
    Version: DTC 1.4.2-dirty
    %
    
    Now it's instead:
    
    % fdtdump --version
    
    **** fdtdump is a low-level debugging tool, not meant for general use.
    **** If you want to decompile a dtb, you probably want
    ****     dtc -I dtb -O dts <filename>
    
    Version: DTC 1.4.5
    %
    
    So the tests broke… (even worse, the whole testsuite broke as pytest
    couldn't compute the list of tests to execute…)
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 tests/comparators/test_dtb.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/comparators/test_dtb.py b/tests/comparators/test_dtb.py
index e66c276..83d7c2d 100644
--- a/tests/comparators/test_dtb.py
+++ b/tests/comparators/test_dtb.py
@@ -36,7 +36,13 @@ dtb2 = load_fixture('devicetree2.dtb')
 
 def fdtdump_version():
     out = subprocess.check_output(('fdtdump', '--version'), stderr=subprocess.STDOUT)
-    return out.decode().split()[2]
+    # We are looking for a line like
+    #   Version: DTC 1.4.5
+    # that usually is placed last
+    for line in reversed(out.decode().splitlines())):
+        if line.startswith('Version: '):
+            return line.split()[2]
+    raise ValueError('Error parsing `fdtdump --version` output')
 
 
 def test_identification(dtb1):

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


More information about the diffoscope mailing list