diff options
Diffstat (limited to '')
-rw-r--r-- | debian/tests/control | 34 | ||||
-rwxr-xr-x | debian/tests/libblkid-dev | 31 | ||||
-rwxr-xr-x | debian/tests/libmount-dev | 31 | ||||
-rwxr-xr-x | debian/tests/libsmartcols-dev | 32 | ||||
-rwxr-xr-x | debian/tests/oversized-chunks | 73 | ||||
-rwxr-xr-x | debian/tests/uuid-dev | 34 |
6 files changed, 235 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..66a50ac --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,34 @@ +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 + |