diff mbox series

[ovs-dev,v4,2/2] debian: Run system testsuites as autopkgtest.

Message ID 20230627101104.72417-2-frode.nordahl@canonical.com
State Changes Requested
Headers show
Series [ovs-dev,v4,1/2] debian: Build package with AF_XDP. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Frode Nordahl June 27, 2023, 10:11 a.m. UTC
The autopkgtests [0][1] are relevant in an upstream context
because an Open vSwitch contributor may want to have a quick
way of running the upstream system testsuites on recent
Debian/Ubuntu releases in an automated and contained manner.

During the Debian/Ubuntu/upstream package source sync work [2], a
relatively naive autopkgtest was added.  It had been around since
Open vSwitch was initially packaged many years ago.

Replace the autopkgtest with a test that runs all the upstream
system testsuites instead.

To run the autopkgtest, take a look at [1] for prerequisites then:

    ./boot.sh && \
        ./configure \
            --prefix=/usr \
            --localstatedir=/var \
            --sysconfdir=/etc \
            --with-dpdk=shared && \
        make debian-source
    autopkgtest \
        --env DEB_BUILD_OPTIONS="nocheck parallel=32" \
        openvswitch_3.1.90-1.dsc \
        -- qemu \
            --cpus 32 \
            --ram-size 8129 \
            autopkgtest-mantic-amd64.img

This patch also adds Cirrus CI jobs that run these tests.

0: https://wiki.debian.org/ContinuousIntegration/autopkgtest
1: https://packaging.ubuntu.com/html/auto-pkg-test.html
2: https://mail.openvswitch.org/pipermail/ovs-dev/2022-July/396219.html

Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 .cirrus.yml                            | 102 ++++++++++++++
 .gitignore                             |   1 +
 Documentation/intro/install/debian.rst |  23 +++-
 debian/automake.mk                     |  33 ++++-
 debian/rules                           |   5 +
 debian/tests/afxdp                     |   1 +
 debian/tests/control                   |  41 +++++-
 debian/tests/dpdk                      |  46 +------
 debian/tests/kmod                      |   1 +
 debian/tests/offloads                  |   1 +
 debian/tests/openflow.py               |  66 ---------
 debian/tests/run-tests.sh              | 183 +++++++++++++++++++++++++
 debian/tests/userspace                 |   1 +
 debian/tests/vanilla                   |  29 ----
 14 files changed, 380 insertions(+), 153 deletions(-)
 create mode 120000 debian/tests/afxdp
 mode change 100755 => 120000 debian/tests/dpdk
 create mode 120000 debian/tests/kmod
 create mode 120000 debian/tests/offloads
 delete mode 100755 debian/tests/openflow.py
 create mode 100755 debian/tests/run-tests.sh
 create mode 120000 debian/tests/userspace
 delete mode 100755 debian/tests/vanilla

Comments

Ilya Maximets July 12, 2023, 9:32 p.m. UTC | #1
On 6/27/23 12:11, Frode Nordahl wrote:
> The autopkgtests [0][1] are relevant in an upstream context
> because an Open vSwitch contributor may want to have a quick
> way of running the upstream system testsuites on recent
> Debian/Ubuntu releases in an automated and contained manner.
> 
> During the Debian/Ubuntu/upstream package source sync work [2], a
> relatively naive autopkgtest was added.  It had been around since
> Open vSwitch was initially packaged many years ago.
> 
> Replace the autopkgtest with a test that runs all the upstream
> system testsuites instead.
> 
> To run the autopkgtest, take a look at [1] for prerequisites then:
> 
>     ./boot.sh && \
>         ./configure \
>             --prefix=/usr \
>             --localstatedir=/var \
>             --sysconfdir=/etc \
>             --with-dpdk=shared && \
>         make debian-source
>     autopkgtest \
>         --env DEB_BUILD_OPTIONS="nocheck parallel=32" \
>         openvswitch_3.1.90-1.dsc \
>         -- qemu \
>             --cpus 32 \
>             --ram-size 8129 \
>             autopkgtest-mantic-amd64.img
> 
> This patch also adds Cirrus CI jobs that run these tests.
> 
> 0: https://wiki.debian.org/ContinuousIntegration/autopkgtest
> 1: https://packaging.ubuntu.com/html/auto-pkg-test.html
> 2: https://mail.openvswitch.org/pipermail/ovs-dev/2022-July/396219.html
> 
> Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>

Hi, Frode.  Thanks for the patch!
Though it looks like there are 3 separate changes:
 - make debian-source
 - autopkgtest
 - CI

Could you split the patch in 3?

I also find it a bit confusing that DPDK test is running AF_XDP
testsuite as well.  May not be needed?

Also, it looks like tests are taking less than half of the runtime
in CI.  Is there a way to re-use the build for multiple tests maybe?
I'm not sure.

> ---
>  .cirrus.yml                            | 102 ++++++++++++++
>  .gitignore                             |   1 +
>  Documentation/intro/install/debian.rst |  23 +++-
>  debian/automake.mk                     |  33 ++++-
>  debian/rules                           |   5 +
>  debian/tests/afxdp                     |   1 +
>  debian/tests/control                   |  41 +++++-
>  debian/tests/dpdk                      |  46 +------
>  debian/tests/kmod                      |   1 +
>  debian/tests/offloads                  |   1 +
>  debian/tests/openflow.py               |  66 ---------
>  debian/tests/run-tests.sh              | 183 +++++++++++++++++++++++++
>  debian/tests/userspace                 |   1 +
>  debian/tests/vanilla                   |  29 ----
>  14 files changed, 380 insertions(+), 153 deletions(-)
>  create mode 120000 debian/tests/afxdp
>  mode change 100755 => 120000 debian/tests/dpdk
>  create mode 120000 debian/tests/kmod
>  create mode 120000 debian/tests/offloads
>  delete mode 100755 debian/tests/openflow.py
>  create mode 100755 debian/tests/run-tests.sh
>  create mode 120000 debian/tests/userspace
>  delete mode 100755 debian/tests/vanilla
> 
> diff --git a/.cirrus.yml b/.cirrus.yml
> index 952d96431..7d3ae86d9 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -32,3 +32,105 @@ freebsd_build_task:
>    check_script:
>      - gmake -j8 check TESTSUITEFLAGS=-j8 RECHECK=yes
>                  || { cat ./tests/testsuite.log; exit 1; }
> +
> +# This tests both the upstream OVS Debian packaging recipe and executes all the
> +# system testsuites on Ubuntu.
> +ubuntu_autopkgtest_latest_task:
> +
> +  compute_engine_instance:
> +    image_project: ubuntu-os-cloud
> +    image: family/ubuntu-2304-amd64
> +    platform: linux
> +    cpu: 4
> +    memory: 4G
> +
> +  env:
> +    DEPENDENCIES: |
> +      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
> +      libbpf-dev libxdp-dev
> +    DPDK: shared
> +    matrix:
> +      TEST_NAME: afxdp
> +      TEST_NAME: dpdk
> +      TEST_NAME: kmod
> +      # Pending resolution of https://launchpad.net/bugs/2020677
> +      # TEST_NAME: offloads
> +      TEST_NAME: userspace
> +
> +  prepare_script: |
> +    apt-get update
> +    if [ "${DPDK}" = no ]; then
> +        echo "Skipping DPDK dependency."
> +    else
> +        apt-get -y install libdpdk-dev
> +    fi
> +    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
> +
> +  configure_script: |
> +    ./boot.sh
> +    ./configure \
> +        --prefix=/usr \
> +        --localstatedir=/var \
> +        --sysconfdir=/etc \
> +        --with-dpdk=${DPDK}
> +
> +  build_script:
> +    - make debian-source
> +
> +  check_script: |
> +    if [ "${DPDK}" = "no" ]; then
> +        deb_dpdk_build_opt="nodpdk"
> +    else
> +        deb_dpdk_build_opt=""
> +    fi
> +    autopkgtest \
> +        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
> +        --test-name $TEST_NAME \
> +        *.dsc \
> +        -- null
> +
> +ubuntu_autopkgtest_lts_task:
> +
> +  compute_engine_instance:
> +    image_project: ubuntu-os-cloud
> +    image: family/ubuntu-2204-lts
> +    platform: linux
> +    cpu: 4
> +    memory: 4G
> +
> +  env:
> +    DEPENDENCIES: |
> +      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
> +    DPDK: no
> +    matrix:
> +      TEST_NAME: kmod
> +      # Pending resolution of https://launchpad.net/bugs/2020677
> +      # TEST_NAME: offloads
> +      TEST_NAME: userspace
> +
> +  prepare_script: |
> +    apt-get update
> +    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
> +
> +  configure_script: |
> +    ./boot.sh
> +    ./configure \
> +        --prefix=/usr \
> +        --localstatedir=/var \
> +        --sysconfdir=/etc \
> +        --with-dpdk=${DPDK}
> +
> +  build_script:
> +    - make debian-source
> +
> +  check_script: |
> +    if [ "${DPDK}" = "no" ]; then
> +        deb_dpdk_build_opt="nodpdk"
> +    else
> +        deb_dpdk_build_opt=""
> +    fi
> +    autopkgtest \
> +        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
> +        --test-name $TEST_NAME \
> +        *.dsc \
> +        -- null

There seems to be some duplication here.  Maybe we can just define
a matrix with 6 sets of variables?  Each set with an image family
and a test name?  Maybe also CPU number.  The only test that needs
4 cores is DPDK.  And we have 16 cores available in parallel.  We
can run 5 jobs with 2 cores each and 1 job with 4 cores.  This way
we'll be able to run all the jobs in parallel saving a noticeable
amount of time.

What do you think?

We may also try to use the templating functionality to avoid
duplication at least:
  https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks

Best regards, Ilya Maximets.
Frode Nordahl July 14, 2023, 8:24 a.m. UTC | #2
On Wed, Jul 12, 2023 at 11:32 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 6/27/23 12:11, Frode Nordahl wrote:
> > The autopkgtests [0][1] are relevant in an upstream context
> > because an Open vSwitch contributor may want to have a quick
> > way of running the upstream system testsuites on recent
> > Debian/Ubuntu releases in an automated and contained manner.
> >
> > During the Debian/Ubuntu/upstream package source sync work [2], a
> > relatively naive autopkgtest was added.  It had been around since
> > Open vSwitch was initially packaged many years ago.
> >
> > Replace the autopkgtest with a test that runs all the upstream
> > system testsuites instead.
> >
> > To run the autopkgtest, take a look at [1] for prerequisites then:
> >
> >     ./boot.sh && \
> >         ./configure \
> >             --prefix=/usr \
> >             --localstatedir=/var \
> >             --sysconfdir=/etc \
> >             --with-dpdk=shared && \
> >         make debian-source
> >     autopkgtest \
> >         --env DEB_BUILD_OPTIONS="nocheck parallel=32" \
> >         openvswitch_3.1.90-1.dsc \
> >         -- qemu \
> >             --cpus 32 \
> >             --ram-size 8129 \
> >             autopkgtest-mantic-amd64.img
> >
> > This patch also adds Cirrus CI jobs that run these tests.
> >
> > 0: https://wiki.debian.org/ContinuousIntegration/autopkgtest
> > 1: https://packaging.ubuntu.com/html/auto-pkg-test.html
> > 2: https://mail.openvswitch.org/pipermail/ovs-dev/2022-July/396219.html
> >
> > Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
>
> Hi, Frode.  Thanks for the patch!
> Though it looks like there are 3 separate changes:
>  - make debian-source
>  - autopkgtest
>  - CI
>
> Could you split the patch in 3?

Yes, that makes sense.

> I also find it a bit confusing that DPDK test is running AF_XDP
> testsuite as well.  May not be needed?

I added that mostly to confirm that building a packaged binary that
supported both DPDK and AF_XDP works as expected, as I missed
supporting that in an earlier iteration of this series. I guess now
that we have established that it works, we don't really need to keep
validating that for every run. Will remove it.

> Also, it looks like tests are taking less than half of the runtime
> in CI.  Is there a way to re-use the build for multiple tests maybe?
> I'm not sure.

There is usually some way to share artifacts across runs, I'll check
what Cirrus can provide us with here. Thank you for the suggestion.

> > ---
> >  .cirrus.yml                            | 102 ++++++++++++++
> >  .gitignore                             |   1 +
> >  Documentation/intro/install/debian.rst |  23 +++-
> >  debian/automake.mk                     |  33 ++++-
> >  debian/rules                           |   5 +
> >  debian/tests/afxdp                     |   1 +
> >  debian/tests/control                   |  41 +++++-
> >  debian/tests/dpdk                      |  46 +------
> >  debian/tests/kmod                      |   1 +
> >  debian/tests/offloads                  |   1 +
> >  debian/tests/openflow.py               |  66 ---------
> >  debian/tests/run-tests.sh              | 183 +++++++++++++++++++++++++
> >  debian/tests/userspace                 |   1 +
> >  debian/tests/vanilla                   |  29 ----
> >  14 files changed, 380 insertions(+), 153 deletions(-)
> >  create mode 120000 debian/tests/afxdp
> >  mode change 100755 => 120000 debian/tests/dpdk
> >  create mode 120000 debian/tests/kmod
> >  create mode 120000 debian/tests/offloads
> >  delete mode 100755 debian/tests/openflow.py
> >  create mode 100755 debian/tests/run-tests.sh
> >  create mode 120000 debian/tests/userspace
> >  delete mode 100755 debian/tests/vanilla
> >
> > diff --git a/.cirrus.yml b/.cirrus.yml
> > index 952d96431..7d3ae86d9 100644
> > --- a/.cirrus.yml
> > +++ b/.cirrus.yml
> > @@ -32,3 +32,105 @@ freebsd_build_task:
> >    check_script:
> >      - gmake -j8 check TESTSUITEFLAGS=-j8 RECHECK=yes
> >                  || { cat ./tests/testsuite.log; exit 1; }
> > +
> > +# This tests both the upstream OVS Debian packaging recipe and executes all the
> > +# system testsuites on Ubuntu.
> > +ubuntu_autopkgtest_latest_task:
> > +
> > +  compute_engine_instance:
> > +    image_project: ubuntu-os-cloud
> > +    image: family/ubuntu-2304-amd64
> > +    platform: linux
> > +    cpu: 4
> > +    memory: 4G
> > +
> > +  env:
> > +    DEPENDENCIES: |
> > +      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
> > +      libbpf-dev libxdp-dev
> > +    DPDK: shared
> > +    matrix:
> > +      TEST_NAME: afxdp
> > +      TEST_NAME: dpdk
> > +      TEST_NAME: kmod
> > +      # Pending resolution of https://launchpad.net/bugs/2020677
> > +      # TEST_NAME: offloads
> > +      TEST_NAME: userspace
> > +
> > +  prepare_script: |
> > +    apt-get update
> > +    if [ "${DPDK}" = no ]; then
> > +        echo "Skipping DPDK dependency."
> > +    else
> > +        apt-get -y install libdpdk-dev
> > +    fi
> > +    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
> > +
> > +  configure_script: |
> > +    ./boot.sh
> > +    ./configure \
> > +        --prefix=/usr \
> > +        --localstatedir=/var \
> > +        --sysconfdir=/etc \
> > +        --with-dpdk=${DPDK}
> > +
> > +  build_script:
> > +    - make debian-source
> > +
> > +  check_script: |
> > +    if [ "${DPDK}" = "no" ]; then
> > +        deb_dpdk_build_opt="nodpdk"
> > +    else
> > +        deb_dpdk_build_opt=""
> > +    fi
> > +    autopkgtest \
> > +        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
> > +        --test-name $TEST_NAME \
> > +        *.dsc \
> > +        -- null
> > +
> > +ubuntu_autopkgtest_lts_task:
> > +
> > +  compute_engine_instance:
> > +    image_project: ubuntu-os-cloud
> > +    image: family/ubuntu-2204-lts
> > +    platform: linux
> > +    cpu: 4
> > +    memory: 4G
> > +
> > +  env:
> > +    DEPENDENCIES: |
> > +      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
> > +    DPDK: no
> > +    matrix:
> > +      TEST_NAME: kmod
> > +      # Pending resolution of https://launchpad.net/bugs/2020677
> > +      # TEST_NAME: offloads
> > +      TEST_NAME: userspace
> > +
> > +  prepare_script: |
> > +    apt-get update
> > +    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
> > +
> > +  configure_script: |
> > +    ./boot.sh
> > +    ./configure \
> > +        --prefix=/usr \
> > +        --localstatedir=/var \
> > +        --sysconfdir=/etc \
> > +        --with-dpdk=${DPDK}
> > +
> > +  build_script:
> > +    - make debian-source
> > +
> > +  check_script: |
> > +    if [ "${DPDK}" = "no" ]; then
> > +        deb_dpdk_build_opt="nodpdk"
> > +    else
> > +        deb_dpdk_build_opt=""
> > +    fi
> > +    autopkgtest \
> > +        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
> > +        --test-name $TEST_NAME \
> > +        *.dsc \
> > +        -- null
>
> There seems to be some duplication here.  Maybe we can just define
> a matrix with 6 sets of variables?  Each set with an image family
> and a test name?  Maybe also CPU number.  The only test that needs
> 4 cores is DPDK.  And we have 16 cores available in parallel.  We
> can run 5 jobs with 2 cores each and 1 job with 4 cores.  This way
> we'll be able to run all the jobs in parallel saving a noticeable
> amount of time.
>
> What do you think?

Yes, I did not like the duplication either, but after staring at the
Cirrus CI docs for a while, I did not really find a good way to do it,
and I also wanted feedback on the idea before spending more time on
it.

> We may also try to use the templating functionality to avoid
> duplication at least:
>   https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks

Ah, thank you for this pointer, I did not find that the last time I
looked at it.

I'll come up with an improved version and send a new proposal, thank
you for your feedback, much appreciated!
diff mbox series

Patch

diff --git a/.cirrus.yml b/.cirrus.yml
index 952d96431..7d3ae86d9 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -32,3 +32,105 @@  freebsd_build_task:
   check_script:
     - gmake -j8 check TESTSUITEFLAGS=-j8 RECHECK=yes
                 || { cat ./tests/testsuite.log; exit 1; }
+
+# This tests both the upstream OVS Debian packaging recipe and executes all the
+# system testsuites on Ubuntu.
+ubuntu_autopkgtest_latest_task:
+
+  compute_engine_instance:
+    image_project: ubuntu-os-cloud
+    image: family/ubuntu-2304-amd64
+    platform: linux
+    cpu: 4
+    memory: 4G
+
+  env:
+    DEPENDENCIES: |
+      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
+      libbpf-dev libxdp-dev
+    DPDK: shared
+    matrix:
+      TEST_NAME: afxdp
+      TEST_NAME: dpdk
+      TEST_NAME: kmod
+      # Pending resolution of https://launchpad.net/bugs/2020677
+      # TEST_NAME: offloads
+      TEST_NAME: userspace
+
+  prepare_script: |
+    apt-get update
+    if [ "${DPDK}" = no ]; then
+        echo "Skipping DPDK dependency."
+    else
+        apt-get -y install libdpdk-dev
+    fi
+    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
+
+  configure_script: |
+    ./boot.sh
+    ./configure \
+        --prefix=/usr \
+        --localstatedir=/var \
+        --sysconfdir=/etc \
+        --with-dpdk=${DPDK}
+
+  build_script:
+    - make debian-source
+
+  check_script: |
+    if [ "${DPDK}" = "no" ]; then
+        deb_dpdk_build_opt="nodpdk"
+    else
+        deb_dpdk_build_opt=""
+    fi
+    autopkgtest \
+        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
+        --test-name $TEST_NAME \
+        *.dsc \
+        -- null
+
+ubuntu_autopkgtest_lts_task:
+
+  compute_engine_instance:
+    image_project: ubuntu-os-cloud
+    image: family/ubuntu-2204-lts
+    platform: linux
+    cpu: 4
+    memory: 4G
+
+  env:
+    DEPENDENCIES: |
+      build-essential fakeroot dpkg-dev devscripts equivs autopkgtest autodep8
+    DPDK: no
+    matrix:
+      TEST_NAME: kmod
+      # Pending resolution of https://launchpad.net/bugs/2020677
+      # TEST_NAME: offloads
+      TEST_NAME: userspace
+
+  prepare_script: |
+    apt-get update
+    apt-get --yes install linux-headers-$(uname -r) ${DEPENDENCIES}
+
+  configure_script: |
+    ./boot.sh
+    ./configure \
+        --prefix=/usr \
+        --localstatedir=/var \
+        --sysconfdir=/etc \
+        --with-dpdk=${DPDK}
+
+  build_script:
+    - make debian-source
+
+  check_script: |
+    if [ "${DPDK}" = "no" ]; then
+        deb_dpdk_build_opt="nodpdk"
+    else
+        deb_dpdk_build_opt=""
+    fi
+    autopkgtest \
+        --env DEB_BUILD_OPTIONS="nocheck parallel=8 ${deb_dpdk_build_opt}" \
+        --test-name $TEST_NAME \
+        *.dsc \
+        -- null
diff --git a/.gitignore b/.gitignore
index 26ed8d3d0..3d4f17b8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,6 +75,7 @@  OvsDpInterface.h
 testsuite.tmp.orig
 /rpm/
 /openvswitch*.tar.gz
+/openvswitch*.dsc
 /tests/lcov/
 /Documentation/_build
 /.venv
diff --git a/Documentation/intro/install/debian.rst b/Documentation/intro/install/debian.rst
index 428a45307..fe6500095 100644
--- a/Documentation/intro/install/debian.rst
+++ b/Documentation/intro/install/debian.rst
@@ -85,17 +85,34 @@  You do not need to be the superuser to build the Debian packages.
 
        $ ./boot.sh && ./configure --disable-afxdp && make debian
 
+   If you want to build a source package you need to set path arguments that
+   match the package recipe::
+
+       $ ./boot.sh && \
+            ./configure \
+                --prefix=/usr \
+                --localstatedir=/var \
+                --sysconfdir=/etc &&\
+            make debian-source
+
 Check your work by running ``dpkg-checkbuilddeps`` in the top level of your OVS
 directory. If you've installed all the dependencies properly,
 ``dpkg-checkbuilddeps`` will exit without printing anything. If you forgot to
 install some dependencies, it will tell you which ones.
 
-5. Build the package::
+5. Build the package.
+
+   If you want binary packages execute the following command::
 
        $ make debian-deb
 
-5. The generated .deb files will be in the parent directory of the Open vSwitch
-   source distribution.
+   If you want a source package execute the following command::
+
+      $ make debian-source
+
+6. The generated binary .deb files will be in the parent directory of the
+   Open vSwitch source distribution.  If you built a source package it will
+   be located in the top level Open vSwitch source directory.
 
 Installing .deb Packages
 ------------------------
diff --git a/debian/automake.mk b/debian/automake.mk
index 414b092a1..28b14c2da 100644
--- a/debian/automake.mk
+++ b/debian/automake.mk
@@ -61,10 +61,13 @@  EXTRA_DIST += \
 	debian/rules \
 	debian/source/format \
 	debian/source/lintian-overrides \
+	debian/tests/afxdp \
 	debian/tests/control \
 	debian/tests/dpdk \
-	debian/tests/openflow.py \
-	debian/tests/vanilla \
+	debian/tests/kmod \
+	debian/tests/offloads \
+	debian/tests/run-tests.sh \
+	debian/tests/userspace \
 	debian/watch
 
 check-debian-changelog-version:
@@ -131,7 +134,6 @@  CLEANFILES += debian/control
 debian: debian/copyright debian/control
 .PHONY: debian
 
-
 debian-deb: debian
 	@if test X"$(srcdir)" != X"$(top_builddir)"; then			\
 		echo "Debian packages should be built from $(abs_srcdir)/";	\
@@ -147,3 +149,28 @@  debian-deb: debian
 	$(AM_V_GEN) fakeroot debian/rules clean
 	$(AM_V_GEN) DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS)" \
 		fakeroot debian/rules binary
+
+debian-source: debian
+	@if test X"$(srcdir)" != X"$(top_builddir)"; then			\
+		echo "Debian packages should be built from $(abs_srcdir)/";	\
+		exit 1;								\
+	fi
+	cp $(srcdir)/debian/control.in $(srcdir)/debian/control
+	$(update_deb_copyright)
+	## Order is significant here as we are modifying the file in-place and
+	## a DPDK enabled binary may support both DPDK and AFXDP.
+	$(update_deb_control_dpdk)
+	$(update_deb_control_afxdp)
+	$(AM_V_GEN) $(MAKE) distdir
+	cp $(srcdir)/debian/control $(srcdir)/debian/copyright \
+		$(distdir)/debian/
+	$(AM_V_GEN) tardir=$(distdir) && $(am__tar) | \
+		eval GZIP= gzip $(GZIP_ENV) \
+		-c >$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.gz
+	cd $(distdir); \
+		$(AM_V_GEN) dpkg-source --compression=gzip -b .
+	$(am__post_remove_distdir)
+
+DISTCLEANFILES += $(PACKAGE_NAME)_$(PACKAGE_VERSION)-1.debian.tar.gz \
+	$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.gz \
+	$(PACKAGE_NAME)_$(PACKAGE_VERSION)-1.dsc
diff --git a/debian/rules b/debian/rules
index 4e09e52b6..2bb2c70e3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -95,6 +95,11 @@  endif
 
 execute_before_dh_auto_clean:
 	find . -name "*.pyc" -delete
+	test -f debian/control && cp debian/control debian/control.save.$(PPID)
+
+execute_after_dh_auto_clean:
+	test -f debian/control.save.$(PPID) && \
+		mv debian/control.save.$(PPID) debian/control
 
 override_dh_auto_install:
 	dh_auto_install --sourcedirectory=_debian
diff --git a/debian/tests/afxdp b/debian/tests/afxdp
new file mode 120000
index 000000000..7080a3249
--- /dev/null
+++ b/debian/tests/afxdp
@@ -0,0 +1 @@ 
+run-tests.sh
\ No newline at end of file
diff --git a/debian/tests/control b/debian/tests/control
index b481ed53c..0a2b1783c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,8 +1,35 @@ 
-Tests: vanilla dpdk
+Tests: afxdp, kmod, offloads, userspace
 Depends:
- iperf,
- mininet (>= 2.2.0~),
- openvswitch-switch,
- openvswitch-switch-dpdk [amd64 i386],
- openvswitch-testcontroller,
-Restrictions: needs-root rw-build-tree isolation-machine
+ @,
+ devscripts,
+ equivs,
+ conntrack,
+ net-tools,
+ netcat-openbsd,
+ python3-pyftpdlib,
+ tcpdump,
+Restrictions:
+ allow-stderr,
+ isolation-machine,
+ needs-root,
+ rw-build-tree,
+
+# The dpdk tests are marked `skippable`, because they have environment specific
+# requirements which may or may not be available at runtime (hugepages setup).
+Tests: dpdk
+Depends:
+ @,
+ conntrack,
+ devscripts,
+ dpdk-dev [amd64 i386 ppc64el arm64 riscv64],
+ equivs,
+ net-tools,
+ netcat-openbsd,
+ python3-pyftpdlib,
+ tcpdump,
+Restrictions:
+ allow-stderr,
+ isolation-machine,
+ needs-root,
+ rw-build-tree,
+ skippable,
diff --git a/debian/tests/dpdk b/debian/tests/dpdk
deleted file mode 100755
index 2aabae050..000000000
--- a/debian/tests/dpdk
+++ /dev/null
@@ -1,45 +0,0 @@ 
-#!/bin/sh
-
-set -e
-
-if [ ! -x /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk ]; then
-    echo "DPDK enabled binary not detected - skipping"
-    exit 0
-fi
-
-sse3flag=$(sed -n "/^flags.*sse3/p" < /proc/cpuinfo | wc -l)
-if [ "${sse3flag}" -eq 0 ]; then
-    echo "sse3 not available in test environment"
-    echo "for adt-virt-qemu please consider adding --qemu-options='-cpu qemu64,+ssse3'"
-    echo "SKIPPING"
-    exit 0
-fi
-
-update-alternatives --set ovs-vswitchd \
-    /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
-service openvswitch-switch restart
-
-modprobe openvswitch || true
-
-echo "kernel modules loaded: "
-# Check that ovs loaded
-lsmod | grep "openvswitch"
-echo "OK"
-
-echo "Checking daemons: "
-pgrep ovs-vswitchd
-pgrep ovsdb-server
-echo "OK"
-
-echo "stop conflicting openvswitch testcontroller"
-systemctl stop openvswitch-testcontroller || true
-
-if dpkg --compare-versions "$(dpkg-query --showformat '${Version}\n' --show mininet)" ge "2.3.0-1"; then
-    PYCMD="python3"
-else
-    PYCMD="python2"
-fi
-
-printf "running openflow tests using mininet"
-${PYCMD} `dirname $0`/openflow.py 2>&1
-echo "OK"
diff --git a/debian/tests/dpdk b/debian/tests/dpdk
new file mode 120000
index 000000000..7080a3249
--- /dev/null
+++ b/debian/tests/dpdk
@@ -0,0 +1 @@ 
+run-tests.sh
\ No newline at end of file
diff --git a/debian/tests/kmod b/debian/tests/kmod
new file mode 120000
index 000000000..7080a3249
--- /dev/null
+++ b/debian/tests/kmod
@@ -0,0 +1 @@ 
+run-tests.sh
\ No newline at end of file
diff --git a/debian/tests/offloads b/debian/tests/offloads
new file mode 120000
index 000000000..7080a3249
--- /dev/null
+++ b/debian/tests/offloads
@@ -0,0 +1 @@ 
+run-tests.sh
\ No newline at end of file
diff --git a/debian/tests/openflow.py b/debian/tests/openflow.py
deleted file mode 100755
index 216b57cf4..000000000
--- a/debian/tests/openflow.py
+++ /dev/null
@@ -1,66 +0,0 @@ 
-import unittest
-import logging
-from mininet.net import Mininet
-import mininet.log as log
-from mininet.node import OVSController, OVSKernelSwitch
-
-Switch = OVSKernelSwitch
-Controller = OVSController
-logging.basicConfig(level=logging.DEBUG)
-log.setLogLevel('info')
-
-
-class BasicOpenflowTest(unittest.TestCase):
-
-    def addHost(self, N):
-        logging.debug("Creating host h%s and add to net.", N)
-        name = 'h%d' % N
-        ip = '10.0.0.%d' % N
-        return self.net.addHost(name, ip=ip)
-
-    def setUp(self):
-        self.net = Mininet(controller=Controller, switch=Switch)
-
-        logging.info("Creating controllers")
-        self.net.addController('c1', command='ovs-testcontroller')
-
-        logging.info("Creating switches")
-        s1 = self.net.addSwitch('s1', protocols="OpenFlow10")
-        s2 = self.net.addSwitch('s2', protocols="OpenFlow10")
-
-        logging.info("Creating hosts (7 on each switch)")
-        hosts1 = [self.addHost(n) for n in (1, 2, 3, 4, 5, 6, 7)]
-        hosts2 = [self.addHost(n) for n in (8, 9, 10, 11, 12, 13, 14)]
-
-        logging.info("Creating links")
-        for h in hosts1:
-            self.net.addLink(s1, h)
-        for h in hosts2:
-            self.net.addLink(s2, h)
-        self.net.addLink(s1, s2)
-
-        logging.info("Starting network")
-        self.net.start()
-
-    def testPingAll(self):
-        logging.info("Testing network")
-        packetLoss = self.net.pingAll()
-        self.assertTrue(
-            packetLoss == 0,
-            "Packet loss during ping test %s" %
-            packetLoss)
-
-    def testIPerfTCP(self):
-        logging.info("Running TCP performance test")
-        self.net.iperf()
-
-    def testIPerfUDP(self):
-        logging.info("Running UDP performance test")
-        self.net.iperf(l4Type='UDP')
-
-    def tearDown(self):
-        logging.info("Stopping network")
-        self.net.stop()
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/debian/tests/run-tests.sh b/debian/tests/run-tests.sh
new file mode 100755
index 000000000..77b1a6d88
--- /dev/null
+++ b/debian/tests/run-tests.sh
@@ -0,0 +1,183 @@ 
+#!/bin/bash
+
+set -ex
+
+PROGRAM=`basename $0`
+TARGET=${PROGRAM}
+
+# The autopkgtests are run in throwaway environments, let's be good citizens
+# regardless, and attempt to clean up any environment modifications.
+function cleanup {
+    rc=$?
+
+    set +e
+
+    # Dump the log to console on error
+    if [ $rc -ne 0 ]; then
+        for logfile in $(ls -1 _debian/tests/system-*-testsuite.log); do
+            printf "%s:\n" $(basename $logfile)
+            cat $logfile
+        done
+    fi
+
+    # The DPDK test requires post-test cleanup steps.
+    if [ "$PROGRAM" = "dpdk" ]; then
+        mv /etc/dpdk/dpdk.conf.bak /etc/dpdk/dpdk.conf
+        systemctl restart dpdk
+
+        update-alternatives \
+            --set ovs-vswitchd \
+            /usr/lib/openvswitch-switch/ovs-vswitchd
+
+        if dirs +1 > /dev/null 2>&1; then
+            popd
+            umount ${BIND_MOUNT_DIR}
+            rmdir ${BIND_MOUNT_DIR}
+        fi
+    fi
+
+    exit $rc
+}
+trap cleanup EXIT
+
+# The DPDK test requires preparing steps.
+if [ "$PROGRAM" = "dpdk" ]; then
+    if [ ! -x /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk ]; then
+        echo "DPDK enabled binary not detected, SKIP test"
+        exit 77
+    fi
+    ARCH=$(dpkg --print-architecture)
+    echo "Check required features on arch: ${ARCH}"
+    case "${ARCH}" in
+        amd64)
+            # For amd64 the OVS DPDK support works with ssse3
+            # https://github.com/openvswitch/ovs/blob/8045c0f8de5192355ca438ed7eef77457c3c1625/acinclude.m4#LL441C52-L441C52
+            if ! grep -q '^flags.*sse3' /proc/cpuinfo; then
+                echo "Missing ssse3 on ${ARCH} - not supported, SKIP test"
+                exit 77
+            fi
+            ;;
+        arm64)
+            if ! grep -q '^Features.*crc32' /proc/cpuinfo; then
+                echo "Missing crc32 on ${ARCH} - not supported, SKIP test"
+                exit 77
+            fi
+            ;;
+    esac
+    echo "no known missing feature on ${ARCH}, continue test"
+
+    # Allocate hugepages, use 2M pages when possible because of higher
+    # probability of successful allocation at runtime and smaller test
+    # footprint in CI virtual machines.
+    #
+    # If the tests are to be run on real physical hardware, you may need
+    # to adjust these variables depending on CPU architecture and topology.
+    numa_node=$(lscpu | awk '/NUMA node\(s\)/{print$3}')
+    if [ -z "$numa_node" -o "$numa_node" -eq 0 ]; then
+        numa_node=1
+    fi
+    DPDK_NR_1G_PAGES=${DPDK_NR_1G_PAGES:-0}
+    DPDK_NR_2M_PAGES=${DPDK_NR_2M_PAGES:-$((${numa_node} * (2667 + 512) / 2))}
+
+    printf "Determine hugepage allocation for %s NUMA Node(s) on arch: %s\n" \
+        ${numa_node} ${ARCH}
+    echo "DPDK_NR_2M_PAGES=${DPDK_NR_2M_PAGES}"
+    echo "DPDK_NR_1G_PAGES=${DPDK_NR_1G_PAGES}"
+
+    mv /etc/dpdk/dpdk.conf /etc/dpdk/dpdk.conf.bak
+    cat << EOF > /etc/dpdk/dpdk.conf
+NR_1G_PAGES=${DPDK_NR_1G_PAGES}
+NR_2M_PAGES=${DPDK_NR_2M_PAGES}
+DROPCACHE_BEFORE_HP_ALLOC=1
+EOF
+    systemctl restart dpdk
+    realhp_2m=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages)
+    realhp_1g=$(cat /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages)
+    if [ "$realhp_2m" != "$DPDK_NR_2M_PAGES" -o \
+         "$realhp_1g" != "$DPDK_NR_1G_PAGES" ]; then
+        echo "Unable to allocate huge pages required for the test, SKIP test"
+        exit 77
+    fi
+
+    # Point `ovs-vswitchd` at the DPDK enabled binary.
+    update-alternatives \
+        --set ovs-vswitchd \
+        /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
+
+    # Long log messages from DPDK library overflow and is written as multiple
+    # lines.  This does not play well with the OVS testsuite assertions.  Even
+    # a tmp directory in /tmp will make the paths too long.
+    #
+    # Realpaths from build will be embedded in testsuite artifacts, so we do
+    # this before the build, and use a bind mount to avoid copying data around
+    # (using a symlink would not be sufficient).
+    #
+    # Ensure we use a short path for running the testsuite (LP:# 2019069).
+    BIND_MOUNT_DIR=$(mktemp -d /XXX)
+    mount --bind . ${BIND_MOUNT_DIR}
+    pushd ${BIND_MOUNT_DIR}
+fi
+
+# A built source tree is required in order to make use of the system level
+# testsuites.  Autopkgtest may be run against both already built and source
+# packages, so we perform this step in either case to ensure the required
+# artifacts are available.
+#
+# We build it here instead of using the `build-needed` Restriction field,
+# because we need to pass in additional environment variables in order to
+# avoid running the build time checks yet another time (they would have just
+# run as part of the package under test build process anyway).
+mk-build-deps \
+    --install \
+    --tool "apt-get -o Debug::pkgProblemResolver=yes \
+            --no-install-recommends --yes" \
+    --remove \
+    debian/control
+
+export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
+debian/rules build
+
+apt-get --yes autoremove openvswitch-build-deps
+
+# Ensure none of the Open vSwitch daemons are running.
+systemctl stop \
+    openvswitch-ipsec \
+    openvswitch-testcontroller \
+    ovs-vswitchd \
+    ovsdb-server
+
+# List of tests to run, an empty list means run all tests.
+TEST_LIST=""
+
+# Run the testsuite.
+#
+# By not having paths from build directory in AUTOTEST_PATH, apart from
+# `tests`, will ensure binaries are executed from system PATH, i.e. from the
+# binary package under test, and not the built source tree.
+#
+# Note that the built testsuite artifacts are put under tests/ in the top level
+# source directory regardless of the use of `make -C ...` in the package
+# source.  The testsuite's configuration (atlocal) is however placed in
+# relation to the value of `-C`.
+#
+# We also cannot use `make` to invoke the testsuite, as we have removed the
+# build dependencies, and `make` will notice the missing sytem headers.
+#
+# The sum of this leads to the invocation method below.
+case "${TARGET}" in
+    dpdk)
+        # Check that the conditional build of debian/control works properly by
+        # including both DPDK and AFXDP tests for the DPDK enabled package.
+        testsuites="afxdp ${TARGET}"
+        ;;
+    *)
+        testsuites=${TARGET}
+        ;;
+esac
+for testsuite in ${testsuites}; do
+    set /bin/bash tests/system-${testsuite}-testsuite \
+            -C _debian/tests \
+            -j1 \
+            AUTOTEST_PATH=$(realpath ./tests):$(realpath ./_debian/tests)
+    $@ ${TEST_LIST} || $@ --recheck
+done
diff --git a/debian/tests/userspace b/debian/tests/userspace
new file mode 120000
index 000000000..7080a3249
--- /dev/null
+++ b/debian/tests/userspace
@@ -0,0 +1 @@ 
+run-tests.sh
\ No newline at end of file
diff --git a/debian/tests/vanilla b/debian/tests/vanilla
deleted file mode 100755
index 80304f4df..000000000
--- a/debian/tests/vanilla
+++ /dev/null
@@ -1,29 +0,0 @@ 
-#!/bin/sh
-
-set -e
-
-echo "Checking service status right after install: "
-# for transparency we want to see all status and then fail if one is inactive
-systemctl status ovsdb-server.service || true
-systemctl status ovs-vswitchd.service || true
-systemctl status openvswitch-switch.service || true
-systemctl is-active ovs-vswitchd.service ovsdb-server.service openvswitch-switch.service
-echo "OK"
-
-echo "Checking daemon pids to exist: "
-pgrep ovs-vswitchd
-pgrep ovsdb-server
-echo "OK"
-
-echo "stop conflicting openvswitch testcontroller"
-systemctl stop openvswitch-testcontroller || true
-
-if dpkg --compare-versions "$(dpkg-query --showformat '${Version}\n' --show mininet)" ge "2.3.0-1"; then
-    PYCMD="python3"
-else
-    PYCMD="python2"
-fi
-
-printf "running openflow tests using mininet"
-${PYCMD} `dirname $0`/openflow.py 2>&1
-echo "OK"