summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
commit08b74a000942a380fe028845f92cd3a0dee827d5 (patch)
treeaa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/tests
parentAdding upstream version 4.19.249. (diff)
downloadlinux-08b74a000942a380fe028845f92cd3a0dee827d5.tar.xz
linux-08b74a000942a380fe028845f92cd3a0dee827d5.zip
Adding debian version 4.19.249-2.debian/4.19.249-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/tests/control8
-rwxr-xr-xdebian/tests/python40
-rw-r--r--debian/tests/selftests88
3 files changed, 136 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 000000000..053bf00bc
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,8 @@
+Tests: python
+Depends: python3, pycodestyle, pyflakes3
+
+Tests: selftests
+Restrictions: breaks-testbed, needs-root, isolation-machine
+Depends: kexec-tools, python3, gcc, make, libpopt-dev, gcc-multilib [amd64], bc, fuse, libfuse-dev, pkg-config, linux-image-4.19.0-21-alpha-generic [alpha], linux-image-4.19.0-21-alpha-smp [alpha], linux-image-4.19.0-21-amd64-unsigned [amd64], linux-image-4.19.0-21-cloud-amd64-unsigned [amd64], linux-image-4.19.0-21-rt-amd64-unsigned [amd64], linux-image-4.19.0-21-arm64-unsigned [arm64], linux-image-4.19.0-21-rt-arm64-unsigned [arm64], linux-image-4.19.0-21-marvell [armel], linux-image-4.19.0-21-rpi [armel], linux-image-4.19.0-21-armmp [armhf], linux-image-4.19.0-21-armmp-lpae [armhf], linux-image-4.19.0-21-rt-armmp [armhf], linux-image-4.19.0-21-parisc [hppa], linux-image-4.19.0-21-parisc-smp [hppa], linux-image-4.19.0-21-parisc64-smp [hppa], linux-image-4.19.0-21-686-unsigned [i386], linux-image-4.19.0-21-686-pae-unsigned [i386], linux-image-4.19.0-21-rt-686-pae-unsigned [i386], linux-image-4.19.0-21-itanium [ia64], linux-image-4.19.0-21-mckinley [ia64], linux-image-4.19.0-21-m68k [m68k], linux-image-4.19.0-21-4kc-malta [mips mipsel], linux-image-4.19.0-21-5kc-malta [mips mips64 mips64el mipsel], linux-image-4.19.0-21-octeon [mips mips64 mips64el mipsel], linux-image-4.19.0-21-loongson-3 [mips64el mipsel], linux-image-4.19.0-21-mips64r6 [mips64r6 mipsr6], linux-image-4.19.0-21-mips64r6el [mips64r6el mipsr6el], linux-image-4.19.0-21-mips32r6 [mipsr6], linux-image-4.19.0-21-mips32r6el [mipsr6el], linux-image-4.19.0-21-powerpc [powerpc], linux-image-4.19.0-21-powerpc-smp [powerpc], linux-image-4.19.0-21-powerpc64 [powerpc ppc64], linux-image-4.19.0-21-powerpcspe [powerpcspe], linux-image-4.19.0-21-powerpc64le [ppc64el], linux-image-4.19.0-21-riscv64 [riscv64], linux-image-4.19.0-21-s390x [s390x], linux-image-4.19.0-21-sh7751r [sh4], linux-image-4.19.0-21-sh7785lcr [sh4], linux-image-4.19.0-21-sparc64 [sparc64], linux-image-4.19.0-21-sparc64-smp [sparc64]
+Classes: smp
+
diff --git a/debian/tests/python b/debian/tests/python
new file mode 100755
index 000000000..c743f21ef
--- /dev/null
+++ b/debian/tests/python
@@ -0,0 +1,40 @@
+#!/bin/bash -eu
+
+sources="$AUTOPKGTEST_TMP/sources"
+
+{
+ # Check Python modules under debian/lib and Python scripts under
+ # debian/bin or debian/rules.d.
+ find debian/lib/python -name '*.py'
+ find debian/bin debian/rules.d -type f -perm /111 |
+ while read script; do
+ # Check for Python shebang on the first line only
+ if awk '/^#!.*python/ { exit 0 } { exit 1 }' "$script"; then
+ echo "$script"
+ fi
+ done
+} > "$sources"
+
+# autopkgtest checks for a non-zero exit code *or* any output to
+# stderr. So we should continue after a failure, but make sure
+# something is written to stderr.
+
+echo "I: Running pycodestyle..."
+# Ignore E126,E226,W503 (ignored by default) and also E127,W291 which
+# give false positives.
+if ! xargs pycodestyle --max-line-length=100 --ignore E126,E127,E226,W291,W503 < "$sources"; then
+ # pycodestyle only writes to stdout
+ echo >&2 "E: pycodestyle detected problems"
+fi
+
+echo "I: Running pyflakes..."
+if ! xargs pyflakes3 < "$sources"; then
+ # pyflakes only writes to stdout
+ echo >&2 "E: pyflakes detected problems"
+fi
+
+echo "I: Running debian_linux.debian unit tests..."
+# unittest only writes to stderr
+if ! PYTHONPATH=debian/lib/python python3 -m debian_linux.debian 2>&1; then
+ echo >&2 "E: some unit tests failed"
+fi
diff --git a/debian/tests/selftests b/debian/tests/selftests
new file mode 100644
index 000000000..c19064ca6
--- /dev/null
+++ b/debian/tests/selftests
@@ -0,0 +1,88 @@
+#!/bin/bash -eu
+
+PATH=/usr/sbin:/sbin:/usr/bin:/bin
+
+getconfig() {
+ debian/bin/getconfig.py "$@"
+}
+
+# Look up current ABI name and 'localversion' (featureset/flavour) suffixes
+abiname=$(getconfig version abiname)
+arch=$(dpkg --print-architecture)
+localversion=()
+for featureset in $(getconfig base $arch featuresets); do
+ if [ "$(getconfig base '' $featureset enabled || echo True)" = True ]; then
+ for flavour in $(getconfig base $arch $featureset flavours); do
+ if [ "$featureset" = none ]; then
+ localversion+=(-$flavour)
+ else
+ localversion+=(-$featureset-$flavour)
+ fi
+ done
+ fi
+done
+steps=${#localversion[*]}
+
+case "${ADT_REBOOT_MARK:-}" in
+ "")
+ step=-1
+ ;;
+ step*)
+ step=${ADT_REBOOT_MARK#step}
+ ;;
+esac
+
+if [ "$step" -ge 0 ]; then
+ ver=$abiname${localversion[$step]}
+
+ if [ "$(uname -r)" != "$ver" ]; then
+ echo >&2 "Should be running: $ver"
+ echo >&2 "Actually running: $(uname -r)"
+ else
+ cp -lR . $ADTTMP/build
+ cd $ADTTMP/build
+ make headers_install
+
+ # Ignore compiler warnings
+ {
+ make -C tools/testing/selftests &&
+ make -C tools/testing/selftests/memfd build_fuse
+ } 2>&1 || echo >&2 "Build failed"
+
+ # Enable testing CLONE_USERNS by unprivileged users
+ sysctl kernel.unprivileged_userns_clone=1
+
+ # Some tests will write to stderr despite being successful,
+ # and the exit code from make will be 0 even if tests failed.
+ # So we have to do some post-analysis...
+ set -o pipefail
+ {
+ make -C tools/testing/selftests quicktest=1 run_tests &&
+ make -C tools/testing/selftests/cpu-hotplug run_full_test &&
+ make -C tools/testing/selftests/memory-hotplug run_full_test &&
+ make -C tools/testing/selftests/memfd run_fuse &&
+ make -C tools/testing/selftests/timers run_destructive_tests
+ } 2>&1 | tee $ADTTMP/log
+ set +o pipefail
+ if grep -E '\[(FAIL|UNSUPPORTED)\]|recipe for target .run_tests. failed' $ADTTMP/log | \
+ grep -q -v \
+ -e '^selftests: fw_userhelper.sh \[FAIL\]' \
+ -e 'ftrace - function profiler with function tracing \[UNSUPPORTED\]' \
+ -e '^selftests: ftracetest \[FAIL\]' \
+ -e '|| echo .*\[FAIL\]' \
+ ; then
+ echo >&2 "Unexpected failures found"
+ fi
+ fi
+fi
+
+step=$((step + 1))
+
+if [ "$step" -lt "$steps" ]; then
+ # Load the next kernel
+ ver=$abiname${localversion[$step]}
+ kexec -l /boot/vmlinuz-$ver --initrd /boot/initrd.img-$ver --reuse-cmdline
+ /tmp/autopkgtest-reboot step$step
+fi
+
+exit 0