publish_dir: ./doc/html
publish_branch: doxygen/${{ github.ref_name }}
- unittests:
+ unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
name: Unit Test Code Coverage
path: lcov.*
+ container-tests:
+ name: Container Tests
+ runs-on: ubuntu-22.04
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: false
+ - name: Initialize the directory
+ uses: ./.github/actions/setup-libcgroup
+ - name: Run container tests
+ run: |
+ pushd tests/ftests
+ ./ftests-container.sh
+ popd
+ - name: Collate code coverage results
+ uses: ./.github/actions/code-coverage
+ - name: Upload code coverage results
+ uses: coverallsapp/github-action@master
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ path-to-lcov: ./lcov.total
+ flag-name: "Container Tests"
+ parallel: True
+ - name: Archive code coverage results
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: Container Tests Code Coverage
+ path: lcov.*
+
+ nocontainer-tests:
+ name: No Container Tests
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: false
+ - name: Initialize the directory
+ uses: ./.github/actions/setup-libcgroup
+ - name: Run container tests
+ run: |
+ pushd tests/ftests
+ ./ftests-nocontainer.sh
+ popd
+ - name: Collate code coverage results
+ uses: ./.github/actions/code-coverage
+ - name: Upload code coverage results
+ uses: coverallsapp/github-action@master
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ path-to-lcov: ./lcov.total
+ flag-name: "No Container Tests"
+ parallel: True
+ - name: Archive code coverage results
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: No Container Tests Code Coverage
+ path: lcov.*
+
+ sudo-tests:
+ name: Sudo Tests
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: false
+ - name: Initialize the directory
+ uses: ./.github/actions/setup-libcgroup
+ - name: Run sudo tests
+ run: |
+ pushd tests/ftests
+ ./ftests-sudo.sh
+ popd
+ - name: Collate code coverage results
+ uses: ./.github/actions/code-coverage
+ - name: Upload code coverage results
+ uses: coverallsapp/github-action@master
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ path-to-lcov: ./lcov.total
+ flag-name: "Sudo Tests"
+ parallel: True
+ - name: Archive code coverage results
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: Sudo Tests Code Coverage
+ path: lcov.*
+
distcheckv2:
name: Cgroup v2 Dist Check
runs-on: ubuntu-22.04
export PYTHONPATH=$PYTHONPATH:$(pwd)
popd
pushd tests/ftests
- ./ftests.py -l 10 -L ftests.log
- ./ftests.py -l 10 -L ftests-nocontainer.log --skip 38,77,80,81 --no-container
+ ./ftests.py -l 10 -L ftests.log --skip 80
+ ./ftests.py -l 10 -L ftests-nocontainer.log --skip 38,72,73,77,80,81,82 \
+ --no-container
popd
- name: Archive test logs
if: ${{ always() }}
name: No systemd Code Coverage
path: lcov.*
- functionaltestsv2:
- name: Cgroup v2 Functional Tests
- runs-on: ubuntu-22.04
-
- steps:
- - name: Install container dependencies
- run: |
- sudo apt-get update
- sudo apt-get install lxc lxd-installer
- - uses: actions/checkout@v4
- with:
- submodules: false
- - name: Initialize the directory
- uses: ./.github/actions/setup-libcgroup
- - name: Run functional tests
- run: |
- pushd src/python/build/lib.*
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- popd
- pushd tests/ftests
- ./ftests.py -l 10 -L ftests.log
- ./ftests.py -l 10 -L ftests-nocontainer.log --no-container
- popd
- - name: Archive test logs
- if: ${{ always() }}
- uses: actions/upload-artifact@v4
- with:
- name: Cgroup v2 test logs
- path: ./*.log
- - name: Collate code coverage results
- uses: ./.github/actions/code-coverage
- - name: Upload code coverage results
- uses: coverallsapp/github-action@master
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- path-to-lcov: ./lcov.total
- flag-name: "Cgroup v2 Functional Tests"
- parallel: True
- - name: Archive code coverage results
- if: ${{ always() }}
- uses: actions/upload-artifact@v4
- with:
- name: Cgroup v2 Code Coverage
- path: lcov.*
-
finalize:
name: Finalize the test run
if: ${{ always() }}
- needs: [unittests, functionaltestsv2, nosystemd]
+ needs: [unit-tests, container-tests, nocontainer-tests, sudo-tests, nosystemd]
runs-on: ubuntu-latest
steps:
- name: Finalize code coverage results
Cgroup.create_and_validate(config, CONTROLLERS, CGNAME1, create_scope=True,
scope_pid=1000000)
except RunError as re:
- if 'Process with ID 1000000 does not exist' not in str(re):
+ if 'Failed to set unit properties: No such process' not in str(re):
raise re
#
#
# libcgroup functional tests Makefile.am
#
-# Copyright (c) 2019-2021 Oracle and/or its affiliates.
+# Copyright (c) 2019-2025 Oracle and/or its affiliates.
# Author: Tom Hromatka <tom.hromatka@oracle.com>
#
-TESTS = ftests-wrapper.sh
+TESTS =
EXTRA_DIST_PYTHON_UTILS = \
cgroup.py \
# Intentionally omit the stress test from the extra dist
# 999-stress-cgroup_init.py
-EXTRA_DIST = README.md ftests-wrapper.sh \
- ${EXTRA_DIST_PYTHON_UTILS} ${EXTRA_DIST_PYTHON_TESTS}
+EXTRA_DIST = README.md \
+ ftests-container.sh \
+ ftests-nocontainer.sh \
+ ftests-sudo.sh \
+ ${EXTRA_DIST_PYTHON_UTILS} \
+ ${EXTRA_DIST_PYTHON_TESTS}
clean-local: clean-local-check
.PHONY: clean-local-check
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-only
+
+AUTOMAKE_SKIPPED=77
+AUTOMAKE_HARD_ERROR=99
+
+START_DIR=$PWD
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+ cp "$SCRIPT_DIR"/*.py "$START_DIR"
+fi
+
+PYTHON_LIBRARY_PATH=(../../src/python/build/lib*)
+if [ -d "${PYTHON_LIBRARY_PATH[0]}" ]; then
+ pushd "${PYTHON_LIBRARY_PATH[0]}" || exit $AUTOMAKE_HARD_ERROR
+ PYTHONPATH="$PYTHONPATH:$(pwd)"
+ export PYTHONPATH
+ popd || exit $AUTOMAKE_HARD_ERROR
+fi
+
+./ftests.py -l 10 -L "$START_DIR/ftests-container.py.log" -n Libcg"$RANDOM"
+RET=$?
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+ rm -f "$START_DIR"/*.py
+ rm -fr "$START_DIR"/__pycache__
+ rm -f ftests-container.py.log
+fi
+
+if [[ $RET -ne $AUTOMAKE_SKIPPED ]] && [[ $RET -ne 0 ]]; then
+ # always return errors from the first test run
+ exit $RET
+fi
+
+if [[ $RET -eq 0 ]]; then
+ exit 0
+fi
+
+if [[ $RET -eq $AUTOMAKE_SKIPPED ]]; then
+ exit $AUTOMAKE_SKIPPED
+fi
+
+# I don't think we should ever get here, but better safe than sorry
+exit $AUTOMAKE_HARD_ERROR
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-only
+
+AUTOMAKE_SKIPPED=77
+AUTOMAKE_HARD_ERROR=99
+
+START_DIR=$PWD
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+ cp "$SCRIPT_DIR"/*.py "$START_DIR"
+fi
+
+PYTHON_LIBRARY_PATH=(../../src/python/build/lib*)
+if [ -d "${PYTHON_LIBRARY_PATH[0]}" ]; then
+ pushd "${PYTHON_LIBRARY_PATH[0]}" || exit $AUTOMAKE_HARD_ERROR
+ PYTHONPATH="$PYTHONPATH:$(pwd)"
+ export PYTHONPATH
+ popd || exit $AUTOMAKE_HARD_ERROR
+fi
+
+./ftests.py -l 10 -L "$START_DIR/ftests-nocontainer.py.log" --no-container
+RET=$?
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+ rm -f "$START_DIR"/*.py
+ rm -fr "$START_DIR"/__pycache__
+ rm -f ftests-nocontainer.py.log
+fi
+
+if [[ $RET -ne $AUTOMAKE_SKIPPED ]] && [[ $RET -ne 0 ]]; then
+ # always return errors from the first test run
+ exit $RET
+fi
+
+if [[ $RET -eq 0 ]]; then
+ exit 0
+fi
+
+if [[ $RET -eq $AUTOMAKE_SKIPPED ]]; then
+ exit $AUTOMAKE_SKIPPED
+fi
+
+# I don't think we should ever get here, but better safe than sorry
+exit $AUTOMAKE_HARD_ERROR
popd || exit $AUTOMAKE_HARD_ERROR
fi
-./ftests.py -l 10 -L "$START_DIR/ftests.py.log" -n Libcg"$RANDOM"
-RET1=$?
-
-./ftests.py -l 10 -L "$START_DIR/ftests-nocontainer.py.log" --no-container \
- -n Libcg"$RANDOM"
-RET2=$?
-
if [ -z "$srcdir" ]; then
# $srcdir is set by automake but will likely be empty when run by hand and
# that's fine
fi
sudo cp "$srcdir../../src/libcgroup_systemd_idle_thread" /bin
-sudo PYTHONPATH="$PYTHONPATH" ./ftests.py -l 10 -s "sudo" \
- -L "$START_DIR/ftests-nocontainer.py.sudo.log" --no-container -n Libcg"$RANDOM"
-RET3=$?
+
+sudo PYTHONPATH="$PYTHONPATH" ./ftests.py -l 10 -L "$START_DIR/ftests-sudo.py.log" \
+ -s "sudo" --no-container
+RET=$?
+
sudo rm /bin/libcgroup_systemd_idle_thread
if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
rm -f "$START_DIR"/*.py
rm -fr "$START_DIR"/__pycache__
- rm -f ftests.py.log
- rm -f ftests-nocontainer.py.log
- rm -f ftests-nocontainer.py.sudo.log
+ rm -f ftests-sudo.py.log
fi
-if [[ $RET1 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET1 -ne 0 ]]; then
+if [[ $RET -ne $AUTOMAKE_SKIPPED ]] && [[ $RET -ne 0 ]]; then
# always return errors from the first test run
- exit $RET1
-fi
-if [[ $RET2 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET2 -ne 0 ]]; then
- # return errors from the second test run
- exit $RET2
-fi
-if [[ $RET3 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET3 -ne 0 ]]; then
- # return errors from the third test run
- exit $RET3
+ exit $RET
fi
-if [[ $RET1 -eq 0 ]] || [[ $RET2 -eq 0 ]] || [[ $RET3 -eq 0 ]]; then
+if [[ $RET -eq 0 ]]; then
exit 0
fi
-if [[ $RET1 -eq $AUTOMAKE_SKIPPED ]] || [[ $RET2 -eq $AUTOMAKE_SKIPPED ]] ||
- [[ $RET3 -eq $AUTOMAKE_SKIPPED ]]; then
+if [[ $RET -eq $AUTOMAKE_SKIPPED ]]; then
exit $AUTOMAKE_SKIPPED
fi