Skip to content

System-emulated accelerators (slash_sysemu) #5

System-emulated accelerators (slash_sysemu)

System-emulated accelerators (slash_sysemu) #5

# ##################################################################################################
# The MIT License (MIT)
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# ##################################################################################################
name: Slash SysEmu unit testing
on:
push:
branches:
- main
- dev
pull_request:
jobs:
vrt_unit_tests:
runs-on: ubuntu-24.04
permissions: { contents: read }
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: "true"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y cmake pkg-config ninja-build \
libxml2-dev libzmq3-dev cppzmq-dev libjsoncpp-dev zlib1g-dev \
libsystemd-dev libinih-dev libcli11-dev lcov python3-zmq
- name: Build and run normal unit tests, generate coverage reports
run: |
mkdir -p slash_sysemu/build/normal
cd slash_sysemu/build/normal
cmake -DSLASH_SYSEMU_BUILD_TESTS=1 -DENABLE_COVERAGE=1 ../..
make unit_tests -j$(nproc)
cd tests && ctest --output-on-failure -j$(nproc)
lcov --capture --directory . --output-file coverage.info \
--ignore-errors mismatch --ignore-errors negative
lcov --remove coverage.info \
'/usr/*' '*/_deps/*' '*/tests/*' \
--output-file coverage.filtered.info \
--ignore-errors unused
genhtml coverage.filtered.info --output-directory coverage-report
lcov --list coverage.filtered.info
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: sysemu-coverage-report
path: slash_sysemu/build/normal/coverage-report/
- name: Build and run unit tests with ASan and UBSan
run: |
mkdir -p slash_sysemu/build/sanitizers
cd slash_sysemu/build/sanitizers
cmake -DSLASH_SYSEMU_BUILD_TESTS=1 -DENABLE_ASAN=1 -DENABLE_UBSAN=1 ../..
make unit_tests -j$(nproc)
cd tests && ctest --output-on-failure -j$(nproc)