summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-03-10 01:49:37 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:58:46 +0100
commit12844170ad33d96cb0c5fa411f4eb62fea6e3d5d (patch)
treeffbfff3aa0edbf3b80678530076b7d4ee09bd124 /test
parenta0975c8d97f06ac116c5cea9a98993817ced0e86 (diff)
support very long mtab entries in mountpoint discovery
Old code limited lines to 250 characters which is probably enough for everybody, but who knows… It also takes care of device nodes which start with the same prefix.
Diffstat (limited to 'test')
-rw-r--r--test/libapt/cdromfindmountpointfordevice_test.cc26
-rw-r--r--test/libapt/makefile6
-rwxr-xr-xtest/libapt/run-tests8
3 files changed, 40 insertions, 0 deletions
diff --git a/test/libapt/cdromfindmountpointfordevice_test.cc b/test/libapt/cdromfindmountpointfordevice_test.cc
new file mode 100644
index 000000000..26dcd1459
--- /dev/null
+++ b/test/libapt/cdromfindmountpointfordevice_test.cc
@@ -0,0 +1,26 @@
+#include <config.h>
+
+#include <apt-pkg/cdromutl.h>
+#include <apt-pkg/configuration.h>
+
+#include <string>
+#include <vector>
+
+#include "assert.h"
+
+int main(int argc, char const *argv[]) {
+ if (argc != 2) {
+ std::cout << "One parameter expected - given " << argc << std::endl;
+ return 100;
+ }
+
+ _config->Set("Dir::state::Mountpoints", argv[1]);
+ equals("/", FindMountPointForDevice("rootfs"));
+ equals("/", FindMountPointForDevice("/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21"));
+ equals("/sys", FindMountPointForDevice("sysfs"));
+ equals("/sys0", FindMountPointForDevice("sysfs0"));
+ equals("/boot/efi", FindMountPointForDevice("/dev/sda1"));
+ equals("/tmp", FindMountPointForDevice("tmpfs"));
+
+ return 0;
+}
diff --git a/test/libapt/makefile b/test/libapt/makefile
index a8e053d6e..66d6ea783 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -94,6 +94,12 @@ SLIBS = -lapt-pkg
SOURCE = cdromreducesourcelist_test.cc
include $(PROGRAM_H)
+# test cdroms FindMountPointForDevice for udev autodetection
+PROGRAM = CdromFindMountPointForDevice${BASENAME}
+SLIBS = -lapt-pkg
+SOURCE = cdromfindmountpointfordevice_test.cc
+include $(PROGRAM_H)
+
# test IndexCopy::ConvertToSourceList
PROGRAM = IndexCopyToSourceList${BASENAME}
SLIBS = -lapt-pkg
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index a056f31f9..0baedcf9e 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -108,6 +108,14 @@ do
"${tmppath}/dists/unstable/InRelease" \
"${tmppath}/dists/broken/Release.gpg"
ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid"
+ elif [ $name = "CdromFindMountPointForDevice${EXT}" ]; then
+ tmppath=$(mktemp)
+ echo 'rootfs / rootfs rw 0 0
+sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
+sysfs0 /sys0 sysfs rw,nosuid,nodev,noexec,relatime 0 0
+/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
+/dev/sda1 /boot/efi vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro 0 0
+tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0' > $tmppath
fi
echo -n "Testing with ${NAME} "