diff mbox series

[ovs-dev,v9,03/11] ci: Run DPDK tests in GitHub Actions.

Message ID 20231120155650.36021-3-david.marchand@redhat.com
State Accepted
Delegated to: Simon Horman
Headers show
Series [ovs-dev,v9,01/11] system-dpdk: Introduce helpers for testpmd. | expand

Checks

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

Commit Message

David Marchand Nov. 20, 2023, 3:56 p.m. UTC
Let's enhance our coverage in the CI and run DPDK system tests.

A few DPDK drivers are enabled in DPDK compilation.

Put DPDK build in $PATH for dpdk-testpmd to be available.
sudo drops PATH= updates and -E alone does not seem to preserve this
variable.
Pass PATH=$PATH when running the tests, as a workaround.
Since those tests are run as root, the collection of logs is updated
accordingly.

In GHA, only two cores are available but some test rely on testpmd using
three lcores.
Add a DPDK_EAL_OPTIONS environment variable and use it to map all
testpmd lcores to core 1 (and leave core 0 alone for OVS main and PMD
threads).

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
---
Changes since v1:
- rebased after DPDK build has been moved out of linux-build.sh,
- restored running "normal" checks in the DPDK jobs,

---
 .ci/dpdk-build.sh                    |  7 ++++---
 .ci/linux-build.sh                   | 15 ++++++++++++++-
 .github/workflows/build-and-test.yml |  7 ++++---
 tests/system-dpdk-macros.at          |  2 +-
 4 files changed, 23 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
index 02dcefef61..35540f0694 100755
--- a/.ci/dpdk-build.sh
+++ b/.ci/dpdk-build.sh
@@ -35,9 +35,10 @@  function build_dpdk()
     DPDK_OPTS="$DPDK_OPTS -Ddeveloper_mode=disabled"
 
     # OVS compilation and "normal" unit tests (run in the CI) do not depend on
-    # any DPDK driver being present.
-    # We can disable all drivers to save compilation time.
-    DPDK_OPTS="$DPDK_OPTS -Ddisable_drivers=*/*"
+    # any DPDK driver.
+    # check-dpdk unit tests requires testpmd and some net/ driver.
+    DPDK_OPTS="$DPDK_OPTS -Denable_apps=test-pmd"
+    DPDK_OPTS="$DPDK_OPTS -Denable_drivers=net/null,net/tap,net/virtio"
 
     # Install DPDK using prefix.
     DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 8227a57487..aa2ecc5050 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -22,6 +22,9 @@  function install_dpdk()
     # Export the following path for pkg-config to find the .pc file.
     export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH
 
+    # Expose dpdk binaries.
+    export PATH=$(pwd)/dpdk-dir/build/bin:$PATH
+
     if [ ! -f "${VERSION_FILE}" ]; then
         echo "Could not find DPDK in $(pwd)/dpdk-dir"
         return 1
@@ -113,7 +116,7 @@  fi
 
 OPTS="${EXTRA_OPTS} ${OPTS} $*"
 
-if [ "$TESTSUITE" ]; then
+if [ "$TESTSUITE" = 'test' ]; then
     # 'distcheck' will reconfigure with required options.
     # Now we only need to prepare the Makefile without sparse-wrapped CC.
     configure_ovs
@@ -123,6 +126,16 @@  if [ "$TESTSUITE" ]; then
         TESTSUITEFLAGS=-j4 RECHECK=yes
 else
     build_ovs
+    for testsuite in $TESTSUITE; do
+        run_as_root=
+        if [ "${testsuite##*dpdk}" != "$testsuite" ]; then
+            sudo sh -c 'echo 1024 > /proc/sys/vm/nr_hugepages' || true
+            [ "$(cat /proc/sys/vm/nr_hugepages)" = '1024' ]
+            export DPDK_EAL_OPTIONS="--lcores 0@1,1@1,2@1"
+            run_as_root="sudo -E PATH=$PATH"
+        fi
+        $run_as_root make $testsuite TESTSUITEFLAGS=-j4 RECHECK=yes
+    done
 fi
 
 exit 0
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index bc5494e863..4f62efb7c3 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -123,10 +123,10 @@  jobs:
             opts:         --enable-shared
 
           - compiler:     gcc
-            testsuite:    test
+            testsuite:    check check-dpdk
             dpdk:         dpdk
           - compiler:     clang
-            testsuite:    test
+            testsuite:    check check-dpdk
             dpdk:         dpdk
 
           - compiler:     gcc
@@ -213,7 +213,8 @@  jobs:
         mkdir logs
         cp config.log ./logs/
         cp -r ./*/_build/sub/tests/testsuite.* ./logs/ || true
-        tar -czvf logs.tgz logs/
+        sudo cp -r ./tests/*testsuite.* ./logs/ || true
+        sudo tar -czvf logs.tgz logs/
 
     - name: upload logs on failure
       if: failure() || cancelled()
diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
index a176a57a4b..35d14bee8f 100644
--- a/tests/system-dpdk-macros.at
+++ b/tests/system-dpdk-macros.at
@@ -94,7 +94,7 @@  m4_define([OVS_DPDK_CHECK_TESTPMD],
 m4_define([OVS_DPDK_START_TESTPMD],
   [AT_CHECK([lscpu], [], [stdout])
    AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE])
-   eal_options="--in-memory --socket-mem="$(cat NUMA_NODE)" --single-file-segments --no-pci"
+   eal_options="$DPDK_EAL_OPTIONS --in-memory --socket-mem="$(cat NUMA_NODE)" --single-file-segments --no-pci"
    options="$1"
    test "$options" != "${options%% -- *}" || options="$options -- "
    eal_options="$eal_options ${options%% -- *}"