Skip to content

Split declaration and implementation of CapioFile class #2432

Split declaration and implementation of CapioFile class

Split declaration and implementation of CapioFile class #2432

Workflow file for this run

name: "CI Tests"
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
codespell-check:
name: "Check codespell conformance"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Run codespell"
uses: codespell-project/actions-codespell@v2
docker-check:
name: "Check Docker image"
runs-on: ubuntu-24.04
strategy:
matrix:
cmake-build-type:
- "Debug"
- "Release"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: "Build Docker image"
uses: docker/build-push-action@v5
with:
build-args: |
CAPIO_BUILD_TESTS=ON
CAPIO_LOG=${{ matrix.cmake-build-type == 'Debug' && 'ON' || 'OFF' }}
CMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }}
load: true
tags: alphaunito/capio:latest
- name: "Run unit tests with Docker"
run: |
echo "Run CAPIO POSIX Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--name capio-docker \
alphaunito/capio:latest \
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO server Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--name capio-docker \
alphaunito/capio:latest \
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO syscall Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--env LD_PRELOAD=libcapio_posix.so \
--name capio-docker \
alphaunito/capio:latest \
jq -n --arg pwd $(pwd) \
'{name: "CAPIO", IO_Graph: [], exclude: [$pwd + "/aNonExistingFile", $pwd, $pwd + "/"]}' \
> test_config.json && \
capio_syscall_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--env LD_PRELOAD=libcapio_posix.so \
--name capio-docker \
alphaunito/capio:latest \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
format-check:
name: "Check ${{ matrix.path }} clang-format conformance"
runs-on: ubuntu-24.04
strategy:
matrix:
path:
- "capio/common"
- "capio/posix"
- "capio/server"
- "capio/tests"
steps:
- uses: actions/checkout@v4
- name: "Run clang-format style check"
uses: DoozyX/clang-format-lint-action@v0.20
with:
source: ${{matrix.path}}
extensions: 'h,cpp,c,hpp'
clangFormatVersion: 16
unit-tests:
name: "Build ${{ matrix.build_type }} with ${{ matrix.compiler }}"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
build_type:
- Debug
- Release
compiler:
- gcc:9
- gcc:10
- gcc:11
- gcc:12
- gcc:13
- gcc:14
- gcc:15
- zhongruoyu/llvm-ports:13.0-trixie
- zhongruoyu/llvm-ports:14.0-trixie
- zhongruoyu/llvm-ports:15.0-trixie
- zhongruoyu/llvm-ports:16.0-trixie
- zhongruoyu/llvm-ports:17.0-trixie
- zhongruoyu/llvm-ports:18-trixie
- zhongruoyu/llvm-ports:19.1-bullseye
- zhongruoyu/llvm-ports:20.1-bullseye
- zhongruoyu/llvm-ports:21.1-bullseye
container:
image: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v4
- name: "Install gfortran (OpenMPI dependency)"
if: ${{ startsWith(matrix.compiler, 'gcc:') }}
run: |
apt update
apt install -y gfortran || true
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-* 100
- name: "Install packages"
run: |
apt update
apt install -y \
libcapstone-dev \
openmpi-bin \
libopenmpi-dev \
ninja-build \
cmake \
make \
sudo \
bash \
git \
jq \
pkg-config \
build-essential \
wget \
tar \
python3 \
python3-pip \
python3-venv
- name: "Run CMake"
shell: bash
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCAPIO_LOG=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DENABLE_COVERAGE=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DCAPIO_BUILD_TESTS=ON \
-G Ninja \
-B ../build \
-S ${GITHUB_WORKSPACE}
cmake --build ../build -j $(nproc)
sudo cmake --install ../build --prefix /usr/local
- name: "Run tests"
id: run-tests
shell: bash
timeout-minutes: 5
env:
CAPIO_DIR: ${{ github.workspace }}
CAPIO_LOG_LEVEL: -1
run: |
jq -n \
--arg pwd $(pwd) \
'{name: "CAPIO", IO_Graph: [], exclude: [$pwd + "/aNonExistingFile", $pwd, $pwd + "/"]}' \
> test_config.json
export CONFIG_PATH=$(realpath test_config.json)
export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
echo "Run CAPIO POSIX Unit tests"
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO server Unit tests"
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO syscall Unit tests"
LD_PRELOAD=libcapio_posix.so \
capio_syscall_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
rm -rf /dev/shm/CAPIO*
LD_PRELOAD=libcapio_posix.so \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
- name: "Show client logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/posix/$(hostname)/posix_thread_*.log
- name: "Show server logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/server/$(hostname)/server_thread_*.log
- name: "Generate coverage report"
if: ${{ matrix.build_type == 'Debug' }}
run: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade gcovr
gcovr \
--exclude-throw-branches \
--xml coverage.xml \
--gcov-executable gcov \
--exclude capio/tests \
../build
- name: "Compute Valid Artifact Name"
if: ${{ matrix.build_type == 'Debug' }}
id: calc-name
run: |
CLEAN_NAME=$(echo "${{ matrix.compiler }}" | tr '/:.' '-' | sed 's/--/-/g')
echo "artifact_name=${CLEAN_NAME}-tests" >> $GITHUB_OUTPUT
- name: "Upload coverage report"
if: ${{ matrix.build_type == 'Debug' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.calc-name.outputs.artifact_name }}
path: ./coverage.xml
retention-days: 1
if-no-files-found: error
upload-to-codecov:
name: "Codecov report upload"
needs: [ "unit-tests" , "codespell-check" , "format-check" ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Download artifacts"
uses: actions/download-artifact@v4
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}