From d5c1538c13e92cfa1185192a8ef103416570840f Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Wed, 12 Oct 2016 13:22:18 +0200 Subject: [PATCH] enable dpdk autotests as dep8 tests The autotests we bundle can be used on machines able to run DPDK. But sadly almost none of them can run inside most common build environments which makes it unavailable for a classic "dh_autotest". But we can define certain characteristics of an dep8 test. In there at least the majority of the tests runs fine. So this adds the autotests as dep8 test. To do so it defines the test as "isolation-machine, needs-root", but even then checks further required capabilities like sse3 and the required huge pages. If prereqs are not met it exits by skipping the test, which counts as PASS. The tests can run successful e.g. with an autopkgtest call that adds the required CPU characteristics. To do so run it like usual but with: autopkgtest [...] -- qemu --qemu-options='-cpu qemu64,+ssse3' [...] So far only amd64 is supported and as mentioned before only if the prereqs are met. But it is written in a way that this can be the groundwork for any other architecture that wants to enable the autotests as well. Change-Id: Ia2a2839ce349b3ea5c22f0b8a589f8a71378adc1 Signed-off-by: Christian Ehrhardt --- debian/tests/control | 4 ++++ debian/tests/test-autotest | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 debian/tests/test-autotest diff --git a/debian/tests/control b/debian/tests/control index 4eb71038..7d624212 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -11,3 +11,7 @@ Tests: test-dkms Restrictions: allow-stderr, isolation-machine, needs-root Depends: kmod, dpdk-igb-uio-dkms [amd64 arm64 i386 ppc64el], dpdk-rte-kni-dkms [amd64 arm64 i386 ppc64el] + +Tests: test-autotest +Restrictions: allow-stderr, isolation-machine, needs-root +Depends: dpdk-dev, python, python-pexpect diff --git a/debian/tests/test-autotest b/debian/tests/test-autotest new file mode 100644 index 00000000..b18ad2a3 --- /dev/null +++ b/debian/tests/test-autotest @@ -0,0 +1,58 @@ +#!/bin/bash +set -eu + +basedir=$(dirname "$0") +. "${basedir}"/check-dpdk-supported-arch.sh + +# since these tests really execute dpdk code they have to check for the +# required minimum cpu features +ARCH=$(dpkg --print-architecture) +echo "Check required features on arch: ${ARCH}" +case "${ARCH}" in + amd64) + if ! grep -q '^flags.*sse3' /proc/cpuinfo; then + echo "Missing sse3 on ${ARCH} - not supported, SKIP test" + exit 0 + fi + ;; + *) + echo "DPDK autotest not supported on ${ARCH}, SKIP test" + exit 0 + ;; +esac +echo "no known missing feature on ${ARCH}, continue test" + +echo "Get required 1G huge pages" +echo 512 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages +sleep 5s +realhp=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) +if [[ "$realhp" != "512" ]]; then + echo "Unable to allocate the huge pages required for the test, SKIP test" + exit 0 +fi + +# fetch build config +. /usr/share/dpdk/dpdk-sdk-env.sh + +# Reasons for not being an dh_autotest +# - needs root and hugepages +# - build environment capabilities too unpredictable +# - certain workarounds needed to get running, needing root for some which is +# not available in the build environment + +# blacklist reasons: +# known upstream: http://www.dpdk.org/ml/archives/dev/2016-May/038849.html +# - KNI: we deliver via dkms but test doesn't match +# - power_acpi_cpufreq: in many environments blocked by other cpufreq +# - power_kvm_vm_autotest: no avail in all environments, only for virt power management e.g. /dev/virtio-ports/virtio.serial.port.poweragent.0 +# - IVSHMEM fails in virtual environment +# - eal_flags needs at least 8 cpus for lcores test not to fail +# - pci doesn't initialize in all virt env causing command not found issues +# - rather slow performance tests not suited for regular build associated tests: ring_perf,mempool_perf,memcpy_perf,hash_perf,timer_perf + +python "${RTE_SDK}/test/autotest.py" \ + "${RTE_SDK}/test/test" \ + "${RTE_TARGET}" \ + "-KNI,power_acpi_cpufreq,power_kvm_vm,IVSHMEM,eal_flags,pci,ring_perf,mempool_perf,memcpy_perf,hash_perf,timer_perf" \ + +echo "OK" -- 2.16.6