summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-10-15 15:22:26 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-10-15 15:22:26 +0200
commitf392ba3602dc759eeeffd719d2eb16fc2d81f5e5 (patch)
tree3bb410d80bfaecac5d1758ad9090e8245caa7b4b /test/integration
parentc7dedfd7e13073c98fefbeff10b69c7512a8366e (diff)
test: Check that apt-ftparchive handles deep paths
This checks for the previous boundaries for path sizes; but we also added a check for many files in a directory, limited to 4096. Sadly the directory check did not fail with the old code either, it's hard to actually get it to fail correctly.
Diffstat (limited to 'test/integration')
-rwxr-xr-xtest/integration/test-apt-ftparchive-corner-cases49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/integration/test-apt-ftparchive-corner-cases b/test/integration/test-apt-ftparchive-corner-cases
new file mode 100755
index 000000000..9f56a52c8
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-corner-cases
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+allowremovemanual
+configarchitecture 'amd64' 'i386'
+
+createpkg() {
+ local PKG="pkg-$1"
+ mkdir -p ./incoming/$PKG/DEBIAN
+ if [ -n "$2" ]; then
+ echo -n "$2" >> ./incoming/$PKG/DEBIAN/control
+ fi
+ echo "Package: $PKG
+Version: 0
+Priority: extra
+Maintainer: No Body <no@example.org>
+Architecture: all
+Depends: foo:i386
+Description: test package" >> ./incoming/$PKG/DEBIAN/control
+ if [ -n "$3" ]; then
+ echo -n "$3" >> ./incoming/$PKG/DEBIAN/control
+ fi
+ testsuccess dpkg-deb --build ./incoming/$PKG/ ./incoming
+ #dpkg-deb -I ./incoming/${PKG}_0_all.deb control
+}
+
+msgmsg 'Test a deep tree'
+msgtest 'Test for succesfull execution of' 'mkdir -p <1024 times x/>'
+testsuccess --nomsg mkdir -p incoming/pkg-deep-tree/$(seq 1024 | sed s#.*#x# | tr '\n' '/')
+msgtest 'Test for succesfull execution of' 'touch <1024 times x/>/y'
+testsuccess --nomsg touch incoming/pkg-deep-tree/$(seq 1024 | sed s#.*#x# | tr '\n' '/')/y
+createpkg deep-tree
+
+testsuccessequal "$(seq 1024 | sed s#.*#x# | tr '\n' '/')y pkg-deep-tree" valgrind aptftparchive contents ./incoming/pkg-deep-tree_0_all.deb
+
+
+msgmsg 'Test many files in one directory'
+
+testsuccess mkdir -p incoming/pkg-many-files/usr/lib/many-files
+testsuccess sh -c 'for i in $(seq -w 4096); do touch incoming/pkg-many-files/usr/lib/many-files/$i; done'
+createpkg many-files
+
+# OMG, this formatting is annoying to implement
+testsuccessequal "$(seq -w 4096 | xargs -IA printf "usr/lib/many-files/%s\t\t\t\t\t %s\n" "A" "pkg-many-files")" valgrind aptftparchive contents ./incoming/pkg-many-files_0_all.deb
+