[Reproducible-commits] [debbindiff] 01/06: Add tests for .ipk comparator

Jérémy Bobbio lunar at moszumanska.debian.org
Wed Jun 24 17:37:04 UTC 2015


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

lunar pushed a commit to branch master
in repository debbindiff.

commit ead9f6812995f4d4b9366333b852e2d981bf73ea
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Wed Jun 24 15:02:45 2015 +0000

    Add tests for .ipk comparator
---
 debian/copyright                            |   9 ++++++
 tests/comparators/test_ipk.py               |  44 ++++++++++++++++++++++++++++
 tests/data/base-files_157-r45695_ar71xx.ipk | Bin 0 -> 49226 bytes
 tests/data/base-files_157-r45918_ar71xx.ipk | Bin 0 -> 49504 bytes
 tests/data/ipk_metadata_expected_diff       |   3 ++
 5 files changed, 56 insertions(+)

diff --git a/debian/copyright b/debian/copyright
index ba483a8..6ae8032 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -88,6 +88,11 @@ License: GPL-3.0+ with font exception
  font, but you are not obligated to do so. If you do not wish to do so, delete
  this exception statement from your version."
 
+Files: tests/data/base-files_157-*_ar71xx.ipk
+Copyright: 2007-2014 OpenWrt.org
+           2010 Vertical Communications
+License: GPL-2
+
 Files: debian/*
 Copyright: 2014-2015 Jérémy Bobbio <lunar at debian.org>
 License: GPL-3+
@@ -109,6 +114,10 @@ License: GPL-3+
  On Debian systems, the complete text of the GNU General
  Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
 
+License: GPL-2
+ On Debian and Debian-based systems, a copy of the GNU General Public
+ License version 2 is available in /usr/share/common-licenses/GPL-2.
+
 License: Expat
  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation
diff --git a/tests/comparators/test_ipk.py b/tests/comparators/test_ipk.py
new file mode 100644
index 0000000..18dd26c
--- /dev/null
+++ b/tests/comparators/test_ipk.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# debbindiff: highlight differences between two builds of Debian packages
+#
+# Copyright © 2015 Jérémy Bobbio <lunar at debian.org>
+#
+# debbindiff 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.
+#
+# debbindiff 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 debbindiff.  If not, see <http://www.gnu.org/licenses/>.
+
+import codecs
+import os.path
+import shutil
+import pytest
+from debbindiff.comparators.ipk import compare_ipk_files
+
+TEST_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/base-files_157-r45695_ar71xx.ipk')
+TEST_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/base-files_157-r45918_ar71xx.ipk')
+
+def test_no_differences():
+    differences = compare_ipk_files(TEST_FILE1_PATH, TEST_FILE1_PATH)
+    assert len(differences) == 0
+
+ at pytest.fixture
+def differences():
+    return compare_ipk_files(TEST_FILE1_PATH, TEST_FILE2_PATH)[0].details # skip container with path
+
+def test_metadata(differences):
+    expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/ipk_metadata_expected_diff')).read()
+    assert differences[0].unified_diff == expected_diff
+
+def test_compressed_files(differences):
+    assert differences[1].details[0].source1 == './control.tar.gz'
+    assert differences[1].details[1].source1 == './data.tar.gz'
diff --git a/tests/data/base-files_157-r45695_ar71xx.ipk b/tests/data/base-files_157-r45695_ar71xx.ipk
new file mode 100644
index 0000000..63e64c0
Binary files /dev/null and b/tests/data/base-files_157-r45695_ar71xx.ipk differ
diff --git a/tests/data/base-files_157-r45918_ar71xx.ipk b/tests/data/base-files_157-r45918_ar71xx.ipk
new file mode 100644
index 0000000..7dcb757
Binary files /dev/null and b/tests/data/base-files_157-r45918_ar71xx.ipk differ
diff --git a/tests/data/ipk_metadata_expected_diff b/tests/data/ipk_metadata_expected_diff
new file mode 100644
index 0000000..9296ad7
--- /dev/null
+++ b/tests/data/ipk_metadata_expected_diff
@@ -0,0 +1,3 @@
+@@ -1 +1 @@
+-gzip compressed data, last modified: Mon May 18 23:26:52 2015, from Unix
++gzip compressed data, last modified: Mon Jun  8 17:31:21 2015, from Unix

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



More information about the Reproducible-commits mailing list