summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:14:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:14:45 +0000
commit1ceecc69711e82bee12203b95ac8fccfaad58b2d (patch)
treeef6b46cbd3d743073ea886c5d1eea074a0a2e295 /debian/tests
parentAdding upstream version 2.36.1. (diff)
downloadutil-linux-1ceecc69711e82bee12203b95ac8fccfaad58b2d.tar.xz
util-linux-1ceecc69711e82bee12203b95ac8fccfaad58b2d.zip
Adding debian version 2.36.1-8+deb11u1.debian/2.36.1-8+deb11u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/tests/control33
-rwxr-xr-xdebian/tests/libblkid-dev31
-rwxr-xr-xdebian/tests/libmount-dev31
-rwxr-xr-xdebian/tests/libsmartcols-dev32
-rwxr-xr-xdebian/tests/oversized-chunks69
-rwxr-xr-xdebian/tests/uuid-dev34
6 files changed, 230 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..13b5d86
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,33 @@
+Tests: oversized-chunks
+Depends: bash,
+ bc,
+ bsdmainutils,
+ bsdutils,
+ dpkg,
+ grep,
+ mount,
+ util-linux
+
+Tests: libblkid-dev
+Depends: build-essential,
+ libblkid-dev,
+ pkg-config
+Restrictions: allow-stderr, superficial
+
+Tests: libmount-dev
+Depends: build-essential,
+ libmount-dev,
+ pkg-config
+Restrictions: allow-stderr, superficial
+
+Tests: libsmartcols-dev
+Depends: build-essential,
+ libsmartcols-dev,
+ pkg-config
+Restrictions: allow-stderr, superficial
+
+Tests: uuid-dev
+Depends: build-essential,
+ pkg-config,
+ uuid-dev
+Restrictions: allow-stderr, superficial
diff --git a/debian/tests/libblkid-dev b/debian/tests/libblkid-dev
new file mode 100755
index 0000000..21cf329
--- /dev/null
+++ b/debian/tests/libblkid-dev
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#include <blkid.h>
+
+#include <assert.h>
+#include <stddef.h>
+
+int main(void)
+{
+ assert(blkid_get_library_version(NULL, NULL) >= 2350);
+ return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs blkid)
+./trivial
diff --git a/debian/tests/libmount-dev b/debian/tests/libmount-dev
new file mode 100755
index 0000000..88ae302
--- /dev/null
+++ b/debian/tests/libmount-dev
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#include <libmount.h>
+
+#include <assert.h>
+#include <stddef.h>
+
+int main(void)
+{
+ assert(mnt_get_library_version(NULL) >= 2350);
+ return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs mount)
+./trivial
diff --git a/debian/tests/libsmartcols-dev b/debian/tests/libsmartcols-dev
new file mode 100755
index 0000000..42055e3
--- /dev/null
+++ b/debian/tests/libsmartcols-dev
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#include <libsmartcols.h>
+
+#include <assert.h>
+#include <stddef.h>
+
+int main(void)
+{
+ assert(scols_get_library_version(NULL) >= 2350);
+ return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs smartcols)
+./trivial
+
diff --git a/debian/tests/oversized-chunks b/debian/tests/oversized-chunks
new file mode 100755
index 0000000..126ae86
--- /dev/null
+++ b/debian/tests/oversized-chunks
@@ -0,0 +1,69 @@
+#!/bin/bash
+#
+# This test was written in response to http://bugs.debian.org/785075 to
+# attempt to automatically catch when/if it happens again.
+# It seems something in the build toolchain is sometimes producing lots
+# of embedded zeroes in the executables.
+# For example in util-linux 2.26.2-2 the /sbin/fstrim was over 2MB in size
+# instead of normal ~ 40kB.
+#
+# Copyright (c) 2015, Andreas Henriksson <andreas@fatal.se>
+set -e
+set -u
+#set -x
+
+PACKAGES="util-linux bsdutils mount"
+# 10k should be large enough to not trigger false positives. Bump this
+# up if needed.
+CHUNKSIZELIMIT="10000"
+
+CURRENT=""
+LAST=""
+RET=0
+
+
+for FILE in $(dpkg -L $PACKAGES | egrep '/s?bin/') ; do
+
+if [ ! -e "$FILE" ]; then
+ #echo "E: target file '$FILE' not found." >&2
+ exit 1
+fi
+
+function chunk_size
+{
+ #echo "DEBUG: start => $1, stop => $2" >&2
+ SIZE=$(echo ibase=16 \; ${2^^} - ${1^^} | bc)
+ #echo "I: Calculated chunk size $SIZE ($2 - $1)" >&2
+ echo $SIZE
+}
+
+hd $FILE | grep -C1 '^\*' | while read -a CURRENT
+do
+ if [ "${CURRENT[0]}" = "--" ]; then
+ #echo "I: Skipping separator" >&2
+ continue
+ fi
+
+ if [ "${CURRENT[0]}" = "*" ]; then
+ #echo "I: Found chunk indicator." >&2
+ START="$LAST"
+ fi
+
+ if [ "$LAST" = "*" ]; then
+ #echo "I: Both start and stop should now be located." >&2
+ STOP="${CURRENT[0]}"
+ CHUNKSIZE=$(chunk_size "$START" "$STOP")
+ if [ "$CHUNKSIZE" -gt "$CHUNKSIZELIMIT" ]; then
+ echo "E: oversized chunk found in $FILE !"
+ ((RET++))
+ fi
+ fi
+
+ #echo "I: Yet another line processed." >&2
+ LAST="${CURRENT[0]}"
+
+done
+
+done
+
+exit $RET
diff --git a/debian/tests/uuid-dev b/debian/tests/uuid-dev
new file mode 100755
index 0000000..527c98c
--- /dev/null
+++ b/debian/tests/uuid-dev
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#include <uuid.h>
+
+#include <assert.h>
+#include <stddef.h>
+
+int main(void)
+{
+ uuid_t uu;
+ assert(uuid_parse("nope", uu) == -1);
+ assert(uuid_parse("139ee05d-d991-4dd1-8ab9-83167cdb5cf0", uu) == 0);
+ return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs uuid)
+./trivial
+