summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:50 +0000
commit63c1e58910cbc3c5cc4b4bdf966f68dd292980a1 (patch)
treeba5913f9f169d5c0391237afbab9c94955ce18ab /debian/tests
parentAdding upstream version 2.39.3. (diff)
downloadutil-linux-63c1e58910cbc3c5cc4b4bdf966f68dd292980a1.tar.xz
util-linux-63c1e58910cbc3c5cc4b4bdf966f68dd292980a1.zip
Adding debian version 2.39.3-6.debian/2.39.3-6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control39
-rwxr-xr-xdebian/tests/libblkid-dev31
-rwxr-xr-xdebian/tests/libmount-dev31
-rwxr-xr-xdebian/tests/libsmartcols-dev32
-rwxr-xr-xdebian/tests/oversized-chunks73
-rwxr-xr-xdebian/tests/uuid-dev34
6 files changed, 240 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..a24f821
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,39 @@
+Tests: oversized-chunks
+Depends:
+ bash,
+ bc,
+ bsdextrautils,
+ bsdutils,
+ dpkg,
+ grep,
+ mount,
+ util-linux
+Restrictions: allow-stderr
+
+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..b610c42
--- /dev/null
+++ b/debian/tests/oversized-chunks
@@ -0,0 +1,73 @@
+#!/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"
+# 80k should be large enough to not trigger false positives. Bump this
+# up if needed. Andreas committed this with 10k, and it was fine until
+# July 2022 on arm* architectures. Suddenly an empty chunk of 56k size
+# appeared in /bin/dmesg. In the interest of having util-linux migrate
+# to testing, Chris has increased this limit and mailed the arm porters.
+CHUNKSIZELIMIT="80000"
+
+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")
+ echo "I: file $FILE has empty chunk starting at $START sized $CHUNKSIZE"
+ 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
+