Add a 'log_owner' matrix variable (passed via LOG_OWNER) to exercise
tmpfiles- and sysusers-managed log ownership in CI instead of inlining
multiple configure options in 'opts'.

When LOG_OWNER is set (as USER or USER:GROUP), .ci/linux-build.sh
passes --enable-tmpfiles-log-ownership, --enable-sysusers-log-ownership,
--with-log-user, and --with-log-group to OVN's configure step via
OVN_OPTS, avoiding passing OVN-specific flags to OVS.

Propagate LOG_OWNER in .ci/ci.sh and .ci/linux-util.sh, and add a
matrix job running the ovn-ctl tests with log_owner=openvswitch in
both test.yml and test-arm.yml.

Signed-off-by: Zhang Hua <[email protected]>
---
 .ci/ci.sh                      |  3 ++-
 .ci/linux-build.sh             | 22 +++++++++++++++++++---
 .ci/linux-util.sh              |  1 +
 .github/workflows/test-arm.yml |  2 ++
 .github/workflows/test.yml     |  2 ++
 5 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/.ci/ci.sh b/.ci/ci.sh
index 19749a039..1f936c3f3 100755
--- a/.ci/ci.sh
+++ b/.ci/ci.sh
@@ -97,7 +97,8 @@ function run_tests() {
         ARCH=$ARCH CC=$CC LIBS=$LIBS OPTS=$OPTS TESTSUITE=$TESTSUITE \
         TEST_RANGE=$TEST_RANGE SANITIZERS=$SANITIZERS DPDK=$DPDK \
         RECHECK=$RECHECK UNSTABLE=$UNSTABLE TIMEOUT=$TIMEOUT \
-        BASE_VERSION=$BASE_VERSION JOBS=$JOBS ./.ci/linux-build.sh
+        BASE_VERSION=$BASE_VERSION JOBS=$JOBS LOG_OWNER=$LOG_OWNER \
+        ./.ci/linux-build.sh
     "
 }
 
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index a71054b44..7ae67bc6b 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -13,6 +13,7 @@ USE_SPARSE=${USE_SPARSE:-"yes"}
 COMMON_CFLAGS=""
 OVN_CFLAGS=""
 OPTS="$OPTS --enable-Werror"
+OVN_OPTS=""
 JOBS=${JOBS:-"-j4"}
 RECHECK=${RECHECK:-"no"}
 TIMEOUT=${TIMEOUT:-"0"}
@@ -70,8 +71,19 @@ function configure_ovs()
 function configure_ovn()
 {
     configure_ovs $*
-    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" $* || \
-    { cat config.log; exit 1; }
+    ./boot.sh && ./configure CFLAGS="${COMMON_CFLAGS} ${OVN_CFLAGS}" \
+        $OVN_OPTS $* || { cat config.log; exit 1; }
+}
+
+function configure_log_owner()
+{
+    local log_user="${LOG_OWNER%%:*}"
+    local log_group="${LOG_OWNER#*:}"
+
+    OVN_OPTS="$OVN_OPTS --enable-tmpfiles-log-ownership"
+    OVN_OPTS="$OVN_OPTS --enable-sysusers-log-ownership"
+    OVN_OPTS="$OVN_OPTS --with-log-user=${log_user}"
+    OVN_OPTS="$OVN_OPTS --with-log-group=${log_group:-$log_user}"
 }
 
 function configure_sanitizers()
@@ -129,7 +141,7 @@ function execute_dist_tests()
     # Now we only need to prepare the Makefile without sparse-wrapped CC.
     configure_ovn
 
-    export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
+    export DISTCHECK_CONFIGURE_FLAGS="$OPTS $OVN_OPTS"
 
     # Just list the tests during distcheck.
     if ! timeout -k 5m -v $TIMEOUT make distcheck \
@@ -240,6 +252,10 @@ function execute_system_tests()
 
 configure_$CC
 
+if [ "$LOG_OWNER" ]; then
+    configure_log_owner
+fi
+
 if [ "$TESTSUITE" ]; then
     case "$TESTSUITE" in
         "test")
diff --git a/.ci/linux-util.sh b/.ci/linux-util.sh
index e2937f3b4..c786a277a 100755
--- a/.ci/linux-util.sh
+++ b/.ci/linux-util.sh
@@ -71,6 +71,7 @@ function sudo_preserve_env()
 Defaults env_keep += "RUNC_CMD OS_IMAGE CENTRAL_IMAGE CHASSIS_IMAGE 
RELAY_IMAGE GW_IMAGE ENABLE_SSL"
 # ovn-ci
 Defaults env_keep += "ARCH CC DPDK LIBS OPTS TESTSUITE TEST_RANGE SANITIZERS 
UNSTABLE BASE_VERSION"
+Defaults env_keep += "LOG_OWNER"
 EOF
     sudo chmod 0440 /etc/sudoers.d/ovn-ci-env
     sudo visudo -cf /etc/sudoers.d/ovn-ci-env
diff --git a/.github/workflows/test-arm.yml b/.github/workflows/test-arm.yml
index ed693713b..93e9f6e78 100644
--- a/.github/workflows/test-arm.yml
+++ b/.github/workflows/test-arm.yml
@@ -22,6 +22,7 @@ jobs:
       TEST_RANGE:  ${{ matrix.cfg.test_range }}
       SANITIZERS:  ${{ matrix.cfg.sanitizers }}
       UNSTABLE:    ${{ matrix.cfg.unstable }}
+      LOG_OWNER:   ${{ matrix.cfg.log_owner }}
       DEPENDENCIES:
       PREINSTALLED_DEPENDENCIES: podman
 
@@ -35,6 +36,7 @@ jobs:
         cfg:
           - { compiler: gcc, opts: --disable-ssl }
           - { compiler: clang, opts: --disable-ssl }
+          - { compiler: gcc, testsuite: test, log_owner: openvswitch, 
test_range: "--keywords=ovn-ctl" }
           - { compiler: gcc, testsuite: dist-test }
           - { compiler: gcc, testsuite: test, test_range: "-300" }
           - { compiler: gcc, testsuite: test, test_range: "301-600" }
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9560a2dd2..f31d6eb4d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -103,6 +103,7 @@ jobs:
       TEST_RANGE:  ${{ matrix.cfg.test_range }}
       SANITIZERS:  ${{ matrix.cfg.sanitizers }}
       UNSTABLE:    ${{ matrix.cfg.unstable }}
+      LOG_OWNER:   ${{ matrix.cfg.log_owner }}
 
     name: linux ${{ join(matrix.cfg.*, ' ') }}
     runs-on: ubuntu-26.04
@@ -113,6 +114,7 @@ jobs:
         cfg:
         - { compiler: gcc, opts: --disable-ssl }
         - { compiler: clang, opts: --disable-ssl }
+        - { compiler: gcc, testsuite: test, log_owner: openvswitch, 
test_range: "--keywords=ovn-ctl" }
         - { compiler: gcc, testsuite: dist-test }
         - { compiler: gcc, testsuite: test, test_range: "-300" }
         - { compiler: gcc, testsuite: test, test_range: "301-600" }
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to