diff mbox series

[ovs-dev,v4,1/7] ci: Add support for userspace system test

Message ID 20230308143211.712618-2-amusil@redhat.com
State Accepted
Headers show
Series Enable system tests over userspace datapath in CI | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Ales Musil March 8, 2023, 2:32 p.m. UTC
Add support for running system tests with
OvS userspace netdev.

Signed-off-by: Ales Musil <amusil@redhat.com>
---
v3: Rebase on top of current main.
v4: Rebase on top of current main.
    Add for spaces for part of command being on new line.
---
 .ci/linux-build.sh | 69 ++++++++++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 23 deletions(-)

Comments

Simon Horman March 9, 2023, 1:10 p.m. UTC | #1
On Wed, Mar 08, 2023 at 03:32:05PM +0100, Ales Musil wrote:
> Add support for running system tests with
> OvS userspace netdev.
> 
> Signed-off-by: Ales Musil <amusil@redhat.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff mbox series

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d7a49b6c0..7dfb5c317 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -7,13 +7,14 @@  ARCH=${ARCH:-"x86_64"}
 COMMON_CFLAGS=""
 OVN_CFLAGS=""
 OPTS="$OPTS --enable-Werror"
+JOBS=${JOBS:-"-j4"}
 
 function configure_ovs()
 {
     pushd ovs
     ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS}" $* || \
     { cat config.log; exit 1; }
-    make -j4 || { cat config.log; exit 1; }
+    make $JOBS || { cat config.log; exit 1; }
     popd
 }
 
@@ -50,34 +51,56 @@  function configure_clang()
     COMMON_CFLAGS="${COMMON_CFLAGS} -Wno-error=unused-command-line-argument"
 }
 
+function execute_tests()
+{
+    # 'distcheck' will reconfigure with required options.
+    # Now we only need to prepare the Makefile without sparse-wrapped CC.
+    configure_ovn
+
+    export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
+    if ! make distcheck CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" $JOBS \
+        TESTSUITEFLAGS="$JOBS $TEST_RANGE" RECHECK=yes
+    then
+        # testsuite.log is necessary for debugging.
+        cat */_build/sub/tests/testsuite.log
+        exit 1
+    fi
+}
+
+function execute_system_tests()
+{
+      type=$1
+      log_file=$2
+
+      configure_ovn $OPTS
+      make $JOBS || { cat config.log; exit 1; }
+      if ! sudo make $JOBS $type TESTSUITEFLAGS="$TEST_RANGE" RECHECK=yes; then
+          # $log_file is necessary for debugging.
+          cat tests/$log_file
+          exit 1
+      fi
+}
+
 configure_$CC
 
 if [ "$TESTSUITE" ]; then
-    if [ "$TESTSUITE" = "system-test" ]; then
-        configure_ovn $OPTS
-        make -j4 || { cat config.log; exit 1; }
-        if ! sudo make -j4 check-kernel TESTSUITEFLAGS="$TEST_RANGE" RECHECK=yes; then
-            # system-kmod-testsuite.log is necessary for debugging.
-            cat tests/system-kmod-testsuite.log
-            exit 1
-        fi
-    else
-        # 'distcheck' will reconfigure with required options.
-        # Now we only need to prepare the Makefile without sparse-wrapped CC.
-        configure_ovn
+    case "$TESTSUITE" in
+        "test")
+        execute_tests
+        ;;
 
-        export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
-        if ! make distcheck CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" -j4 \
-            TESTSUITEFLAGS="-j4 $TEST_RANGE" RECHECK=yes
-        then
-            # testsuite.log is necessary for debugging.
-            cat */_build/sub/tests/testsuite.log
-            exit 1
-        fi
-    fi
+        "system-test")
+        execute_system_tests "check-kernel" "system-kmod-testsuite.log"
+        ;;
+
+        "system-test-userspace")
+        execute_system_tests "check-system-userspace" \
+            "system-userspace-testsuite.log"
+        ;;
+    esac
 else
     configure_ovn $OPTS
-    make -j4 || { cat config.log; exit 1; }
+    make $JOBS || { cat config.log; exit 1; }
 fi
 
 exit 0