]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
github: dist: Rework the unit tests v3.2.0
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 8 Apr 2025 23:19:40 +0000 (17:19 -0600)
committerKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 10 Apr 2025 09:38:45 +0000 (15:08 +0530)
Add a configure option to enable/disable the unit tests. Because of their
dependency upon googletest, they're very difficult to run for distros.
This allows them to packaged with libcgroup, but they are disabled by
default.  They can be enabled via the config option `--enable-unittests`.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
.github/workflows/continuous-integration.yml
configure.ac
tests/gunit/Makefile.am

index c93960a41a064c6de35717bd006b6d1a0c4508fa..42c8eab5c83a46ad573021f242f47a85525f6e4d 100644 (file)
@@ -104,14 +104,13 @@ jobs:
         submodules: false
     - name: Initialize the directory
       uses: ./.github/actions/setup-libcgroup
+    - name: Reconfigure libcgroup with unit tests enabled
+      run: CFLAGS="$CFLAGS -Werror" ./configure --sysconfdir=/etc --localstatedir=/var --enable-code-coverage --enable-opaque-hierarchy="name=systemd" --enable-python --enable-unittests
     - name: Run unit tests
       run: |
         pushd tests/gunit
         make check
         popd
-    - name: Display test logs
-      if: ${{ always() }}
-      run: cat tests/gunit/test-suite.log
     - name: Collate code coverage results
       uses: ./.github/actions/code-coverage
     - name: Upload code coverage results
index 91efade8b9c21959f76bd5fff243d2e0a8fdf354..849c0da97240473944137d4361056aa15f7820ae 100644 (file)
@@ -170,6 +170,18 @@ AC_ARG_ENABLE([samples],
        [with_samples=false])
 AM_CONDITIONAL([WITH_SAMPLES], [test x$with_samples = xtrue])
 
+AC_ARG_ENABLE([unittests],
+      [AS_HELP_STRING([--enable-unittests],[compile libcgroup unit tests [default=no]])],
+      [
+               if test "x$enableval" = xno; then
+                       with_unittests=false
+               else
+                       with_unittests=true
+               fi
+       ],
+       [with_unittests=false])
+AM_CONDITIONAL([WITH_UNITTESTS], [test x$with_unittests = xtrue])
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
index 18c634d0b3984110c7408f216f5f3e8b5fa3f2ff..ef24feed5c395e313b21d43442631da9f7d94ac7 100644 (file)
@@ -2,10 +2,12 @@
 #
 # libcgroup googletests Makefile.am
 #
-# Copyright (c) 2019 Oracle and/or its affiliates.  All rights reserved.
+# Copyright (c) 2019-2025 Oracle and/or its affiliates.
 # Author: Tom Hromatka <tom.hromatka@oracle.com>
 #
 
+if WITH_UNITTESTS
+
 AM_CPPFLAGS = -I$(top_srcdir)/include \
              -I$(top_srcdir)/src \
              -I$(top_srcdir)/src/tools \
@@ -51,3 +53,5 @@ gtest_LDFLAGS = -L$(top_srcdir)/googletest/build/lib -l:libgtest.a \
 
 clean-local:
        ${RM} test-procpidcgroup
+
+endif