Commit d4ce0506 authored by Chris Lamb's avatar Chris Lamb 💬

test_dtb.py: Only parse the version number, not any "-dirty" suffix. (Closes: #880279)

parent ccda8662
......@@ -18,6 +18,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 re
import pytest
import subprocess
......@@ -35,14 +36,16 @@ dtb2 = load_fixture('devicetree2.dtb')
def fdtdump_version():
out = subprocess.check_output(('fdtdump', '--version'), stderr=subprocess.STDOUT)
# 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')
out = subprocess.check_output(
('fdtdump', '--version'),
stderr=subprocess.STDOUT,
).decode('utf-8')
m = re.search(r'Version: DTC (?P<version>\d+\.\d+\.\d+)', out)
if m is None:
raise ValueError("Error parsing `fdtdump --version` output")
return m.group('version')
def test_identification(dtb1):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment