[diffoscope] 02/02: Add tests for .dtb files.
Vagrant Cascadian
vagrant at moszumanska.debian.org
Mon Apr 24 19:22:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
vagrant pushed a commit to branch experimental
in repository diffoscope.
commit 8fd24d7f6cbb9fe89063cfb5add0d225841adabb
Author: Vagrant Cascadian <vagrant at debian.org>
Date: Mon Apr 24 10:35:52 2017 -0700
Add tests for .dtb files.
Gbp-Dch: ignore
---
debian/control | 1 +
debian/copyright | 12 ++++++
tests/comparators/test_dtb.py | 57 +++++++++++++++++++++++++++++
tests/data/devicetree1.dtb | Bin 0 -> 68260 bytes
tests/data/devicetree2.dtb | Bin 0 -> 68323 bytes
tests/data/devicetree_expected_diff | 71 ++++++++++++++++++++++++++++++++++++
6 files changed, 141 insertions(+)
diff --git a/debian/control b/debian/control
index d0eef28..e3cbc55 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends:
dh-python (>= 2.20160818~),
docx2txt <!nocheck>,
dpkg-dev (>= 1.17.14),
+ device-tree-compiler <!nocheck>,
enjarify <!nocheck>,
fontforge-extras <!nocheck>,
fp-utils <!nocheck>,
diff --git a/debian/copyright b/debian/copyright
index ac52ac0..8c0e230 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -93,6 +93,18 @@ Copyright: 2007-2014 OpenWrt.org
2010 Vertical Communications
License: GPL-2
+Files: tests/data/devicetree*.dtb
+Copyright:
+ 2015 Nikolaus Schaller <hns at goldelico.com>
+ 2012 Texas Instruments Incorporated - http:www.ti.com/
+ 2011 Texas Instruments Incorporated - http:www.ti.com/
+ 2013 Linaro, Ltd.
+ 2015 Sakari Ailus
+ 2011 Texas Instruments Incorporated - http:www.ti.com/
+ 2017 Texas Instruments Incorporated - http:www.ti.com/
+ 2009-2010 Texas Instruments / 2009 Nokia
+License: GPL-2
+
Files: debian/*
Copyright: 2014-2015 Jérémy Bobbio <lunar at debian.org>
License: GPL-3+
diff --git a/tests/comparators/test_dtb.py b/tests/comparators/test_dtb.py
new file mode 100644
index 0000000..8dbc6c3
--- /dev/null
+++ b/tests/comparators/test_dtb.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2016 Emanuel Bronshtein <e3amn2l at gmx.com>
+# Copyright © 2017 Vagrant Cascadian <vagrant at debian.org>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+
+import pytest
+import subprocess
+
+from diffoscope.config import Config
+from diffoscope.comparators.dtb import DeviceTreeFile
+from diffoscope.comparators.missing_file import MissingFile
+
+from utils.data import load_fixture, get_data
+from utils.tools import skip_unless_tools_exist
+
+# Generated by: dtc --in-format=dts --out-format=dtb --out=devicetree1.dtb devicetree1.dts
+dtb1 = load_fixture('devicetree1.dtb')
+# Generated by: dtc --in-format=dts --out-format=dtb --out=devicetree2.dtb devicetree2.dts
+dtb2 = load_fixture('devicetree2.dtb')
+
+def test_identification(dtb1):
+ assert isinstance(dtb1, DeviceTreeFile)
+
+def test_no_differences(dtb1):
+ difference = dtb1.compare(dtb1)
+ assert difference is None
+
+ at pytest.fixture
+def differences(dtb1, dtb2):
+ return dtb1.compare(dtb2).details
+
+ at skip_unless_tools_exist('fdtdump')
+def test_diff(differences):
+ expected_diff = get_data('devicetree_expected_diff')
+ assert differences[0].unified_diff == expected_diff
+
+ at skip_unless_tools_exist('fdtdump')
+def test_compare_non_existing(monkeypatch, dtb1):
+ monkeypatch.setattr(Config(), 'new_file', True)
+ difference = dtb1.compare(MissingFile('/nonexisting', dtb1))
+ assert difference.source2 == '/nonexisting'
+ assert len(difference.details) > 0
diff --git a/tests/data/devicetree1.dtb b/tests/data/devicetree1.dtb
new file mode 100644
index 0000000..996dc01
Binary files /dev/null and b/tests/data/devicetree1.dtb differ
diff --git a/tests/data/devicetree2.dtb b/tests/data/devicetree2.dtb
new file mode 100644
index 0000000..8e4fb0c
Binary files /dev/null and b/tests/data/devicetree2.dtb differ
diff --git a/tests/data/devicetree_expected_diff b/tests/data/devicetree_expected_diff
new file mode 100644
index 0000000..7e4f5ed
--- /dev/null
+++ b/tests/data/devicetree_expected_diff
@@ -0,0 +1,71 @@
+@@ -1,18 +1,18 @@
+ /dts-v1/;
+ // magic: 0xd00dfeed
+-// totalsize: 0x10aa4 (68260)
++// totalsize: 0x10ae3 (68323)
+ // off_dt_struct: 0x38
+-// off_dt_strings: 0x10234
++// off_dt_strings: 0x10264
+ // off_mem_rsvmap: 0x28
+ // version: 17
+ // last_comp_version: 16
+ // boot_cpuid_phys: 0x0
+-// size_dt_strings: 0x870
+-// size_dt_struct: 0x101fc
++// size_dt_strings: 0x87f
++// size_dt_struct: 0x1022c
+
+ / {
+ compatible = "openpandora,omap3-pandora-1ghz", "ti,omap36xx", "ti,omap3";
+ interrupt-parent = <0x00000001>;
+ #address-cells = <0x00000001>;
+ #size-cells = <0x00000001>;
+ model = "Pandora Handheld Console 1GHz";
+@@ -82,14 +82,15 @@
+ #size-cells = <0x00000001>;
+ ranges = <0x00000000 0x00002000 0x00002000>;
+ pinmux at 30 {
+ compatible = "ti,omap3-padconf", "pinctrl-single";
+ reg = <0x00000030 0x00000238>;
+ #address-cells = <0x00000001>;
+ #size-cells = <0x00000000>;
++ #pinctrl-cells = <0x00000001>;
+ #interrupt-cells = <0x00000001>;
+ interrupt-controller;
+ pinctrl-single,register-width = <0x00000010>;
+ pinctrl-single,function-mask = <0x0000ff1f>;
+ linux,phandle = <0x000000e4>;
+ phandle = <0x000000e4>;
+ pinmux_mmc1_pins {
+@@ -240,14 +241,15 @@
+ clockdomains {
+ };
+ pinmux at a00 {
+ compatible = "ti,omap3-padconf", "pinctrl-single";
+ reg = <0x00000a00 0x0000005c>;
+ #address-cells = <0x00000001>;
+ #size-cells = <0x00000000>;
++ #pinctrl-cells = <0x00000001>;
+ #interrupt-cells = <0x00000001>;
+ interrupt-controller;
+ pinctrl-single,register-width = <0x00000010>;
+ pinctrl-single,function-mask = <0x0000ff1f>;
+ pinmux_twl4030_vpins {
+ pinctrl-single,pins = <0x00000000 0x00000100 0x00000002 0x00000100 0x00000006 0x00000000 0x00000018 0x00000000>;
+ linux,phandle = <0x000000e7>;
+@@ -3500,14 +3502,15 @@
+ ti,abb_info = <0x000f7314 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00124f80 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x001437c8 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x0014fb18 0x00000001 0x00000000 0x00000000 0x00000000 0x00000000>;
+ };
+ pinmux at 480025a0 {
+ compatible = "ti,omap3-padconf", "pinctrl-single";
+ reg = <0x480025a0 0x0000005c>;
+ #address-cells = <0x00000001>;
+ #size-cells = <0x00000000>;
++ #pinctrl-cells = <0x00000001>;
+ #interrupt-cells = <0x00000001>;
+ interrupt-controller;
+ pinctrl-single,register-width = <0x00000010>;
+ pinctrl-single,function-mask = <0x0000ff1f>;
+ pinctrl-names = "default";
+ pinctrl-0 = <0x00000106 0x00000107>;
+ pinmux_hsusb2_2_pins {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the Reproducible-commits
mailing list