add testcase for Bug#718329
authorMichael Vogt <mvo@debian.org>
Sat, 22 Feb 2014 20:07:38 +0000 (21:07 +0100)
committerMichael Vogt <mvo@debian.org>
Sat, 22 Feb 2014 20:07:38 +0000 (21:07 +0100)
test/integration/framework
test/integration/test-apt-bug-718329-support-data.tar [new file with mode: 0755]

index 63df86d..be2cb95 100644 (file)
@@ -377,6 +377,7 @@ buildsimplenativepackage() {
        local SECTION="${7:-others}"
        local PRIORITY="${8:-optional}"
         local FILE_TREE="$9"
+        local COMPRESS_TYPE="${10:-gzip}"
        local DISTSECTION
        if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
                DISTSECTION="main"
@@ -442,7 +443,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
                local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
                # ensure the right permissions as dpkg-deb ensists
                chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
-               if ! dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
+               if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
                        cat $LOG
                        false
                fi
diff --git a/test/integration/test-apt-bug-718329-support-data.tar b/test/integration/test-apt-bug-718329-support-data.tar
new file mode 100755 (executable)
index 0000000..5cfb319
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+test_process_package_with_compression() {
+    COMPRESSOR="$1"
+    DATA_TAR="$2"
+
+    msgtest "Testing apt-ftparchive with compression type: $COMPRESSOR"
+
+    buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR"
+    testequal "debian-binary
+control.tar.gz
+$DATA_TAR" ar t incoming/pkg_1.0_all.deb
+
+    testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)"
+
+    testequal "usr/bin/pkg-all                                             pkg
+usr/share/doc/pkg/FEATURES                                 pkg
+usr/share/doc/pkg/changelog                                pkg
+usr/share/doc/pkg/copyright                                pkg" aptftparchive contents incoming/
+
+    rm -rf incoming/*
+}
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+test_process_package_with_compression "gzip" "data.tar.gz"
+test_process_package_with_compression "none" "data.tar"
+test_process_package_with_compression "xz" "data.tar.xz"
+
+
+