-
Notifications
You must be signed in to change notification settings - Fork 13
VRT unit testing #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JOOpdenhoevel
wants to merge
18
commits into
Xilinx:dev
Choose a base branch
from
JOOpdenhoevel:feature/vrt-unit-testing
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
VRT unit testing #65
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
77c80cc
Adding a hello-world test to VRT
JOOpdenhoevel 2e5cfa9
Adding a simple workflow to run the VRT unit tests
JOOpdenhoevel 4dd05fe
Fixing the multi-line usage in the GitHub Actions workflow
JOOpdenhoevel 0040040
Using sudo to install packages
JOOpdenhoevel b77214c
Also checking out submodules
JOOpdenhoevel 57d2922
Merge remote-tracking branch 'Xilinx/dev' into feature/vrt-unit-testing
JOOpdenhoevel a5daf97
Generating test cases for units in VRT that don't need a VBIN file
JOOpdenhoevel 8c1c6cb
Adding code coverage to the VRT unit tests
JOOpdenhoevel a4936a6
Adding unit tests for emulation and simulation using a stub VBIN
JOOpdenhoevel f4a8459
Also calling kernels in the sim tests
JOOpdenhoevel 723b6ec
Removing the original VRT unit testing branch as a possible trigger f…
JOOpdenhoevel 6717116
Adding copyright headers
JOOpdenhoevel 72e61f1
Merging the sim tests and emu tests into one test
JOOpdenhoevel c8be9dc
Adding round-trip testing functionality to the device tests
JOOpdenhoevel 64b4c7d
Merge remote-tracking branch 'Xilinx/dev' into feature/vrt-unit-testing
JOOpdenhoevel 34d7476
Fixing the Device::getKernel function
JOOpdenhoevel 2d35a31
Making VRT unit tests optional
JOOpdenhoevel 1a4c442
Merge remote-tracking branch 'Xilinx/dev' into feature/vrt-unit-testing
JOOpdenhoevel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # ################################################################################################## | ||
| # 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: VRT 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 update | ||
| sudo apt upgrade -y | ||
| sudo apt install -y cmake pkg-config ninja-build \ | ||
| libxml2-dev libzmq3-dev libjsoncpp-dev zlib1g-dev \ | ||
| libsystemd-dev libinih-dev libcli11-dev lcov python3-zmq | ||
|
|
||
| - name: Build and run VRT unit tests | ||
| run: | | ||
| mkdir vrt/build | ||
| cd vrt/build | ||
| cmake -DVRT_INCLUDE_VRTD=1 -DVRTD_INCLUDE_LIBSLASH=1 -DENABLE_COVERAGE=1 .. | ||
| make unit_tests -j$(nproc) | ||
| cd tests && ctest --output-on-failure | ||
|
|
||
| - name: Generate coverage report | ||
| run: | | ||
| cd vrt/build | ||
| lcov --capture --directory . --output-file coverage.info \ | ||
| --ignore-errors mismatch --ignore-errors negative | ||
| lcov --remove coverage.info \ | ||
| '/usr/*' '*/build/_deps/*' '*/vrtd/*' '*/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: vrt-coverage-report | ||
| path: vrt/build/coverage-report/ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ Thumbs.db | |
|
|
||
| __pycache__/ | ||
| *.pyc | ||
| .venv/ | ||
|
|
||
| # Build files for package | ||
| /pbuild/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| pyzmq | ||
| jinja2 | ||
| pytest | ||
| pytest-cov | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| googletest | ||
| URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.zip | ||
| ) | ||
| FetchContent_MakeAvailable(googletest) | ||
|
|
||
| enable_testing() | ||
|
|
||
| include(GoogleTest) | ||
|
|
||
| add_custom_target(unit_tests) | ||
|
|
||
| macro(add_vrt_test test_name test_source) | ||
| add_executable(${test_name} ${test_source}) | ||
| target_link_libraries(${test_name} PRIVATE GTest::gtest_main GTest::gmock vrt::vrt) | ||
| gtest_discover_tests(${test_name}) | ||
| add_dependencies(unit_tests ${test_name}) | ||
| endmacro() | ||
|
|
||
| add_vrt_test(register_test register_test.cpp) | ||
| add_vrt_test(qdma_connection_test qdma_connection_test.cpp) | ||
| add_vrt_test(logger_test logger_test.cpp) | ||
| add_vrt_test(utilization_data_test utilization_data_test.cpp) | ||
| add_vrt_test(filesystem_cache_test filesystem_cache_test.cpp) | ||
| add_vrt_test(xml_parser_test xml_parser_test.cpp) | ||
| add_vrt_test(utilization_parser_test utilization_parser_test.cpp) | ||
| add_vrt_test(kernel_test kernel_test.cpp) | ||
| add_vrt_test(vrtbin_test vrtbin_test.cpp) | ||
|
|
||
| # --- Stub VBIN generation --- | ||
| set(STUB_VBIN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fixtures/stub_vbin) | ||
|
|
||
| set(STUB_EMU_VBIN ${CMAKE_CURRENT_BINARY_DIR}/stub_emu.vbin) | ||
| add_custom_command( | ||
| OUTPUT ${STUB_EMU_VBIN} | ||
| COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging | ||
| COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging | ||
| COMMAND ${CMAKE_COMMAND} -E copy | ||
| ${STUB_VBIN_DIR}/system_map_emu.xml | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging/system_map.xml | ||
| COMMAND ${CMAKE_COMMAND} -E copy | ||
| ${STUB_VBIN_DIR}/emu_manifest.json | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging/emu_manifest.json | ||
| COMMAND ${CMAKE_COMMAND} -E copy | ||
| ${STUB_VBIN_DIR}/vrt_stub_server.py | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging/vpp_emu | ||
| COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging/vpp_emu | ||
| COMMAND tar cf ${STUB_EMU_VBIN} | ||
| -C ${CMAKE_CURRENT_BINARY_DIR}/stub_emu_staging . | ||
| DEPENDS | ||
| ${STUB_VBIN_DIR}/system_map_emu.xml | ||
| ${STUB_VBIN_DIR}/emu_manifest.json | ||
| ${STUB_VBIN_DIR}/vrt_stub_server.py | ||
| COMMENT "Creating emulation stub VBIN" | ||
| ) | ||
|
|
||
| set(STUB_SIM_VBIN ${CMAKE_CURRENT_BINARY_DIR}/stub_sim.vbin) | ||
| add_custom_command( | ||
| OUTPUT ${STUB_SIM_VBIN} | ||
| COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging | ||
| COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging | ||
| COMMAND ${CMAKE_COMMAND} -E copy | ||
| ${STUB_VBIN_DIR}/system_map_sim.xml | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging/system_map.xml | ||
| COMMAND ${CMAKE_COMMAND} -E copy | ||
| ${STUB_VBIN_DIR}/vrt_stub_server.py | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging/vpp_sim | ||
| COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging/vpp_sim | ||
| COMMAND tar cf ${STUB_SIM_VBIN} | ||
| -C ${CMAKE_CURRENT_BINARY_DIR}/stub_sim_staging . | ||
| DEPENDS | ||
| ${STUB_VBIN_DIR}/system_map_sim.xml | ||
| ${STUB_VBIN_DIR}/vrt_stub_server.py | ||
| COMMENT "Creating simulation stub VBIN" | ||
| ) | ||
|
|
||
| add_custom_target(stub_vbins DEPENDS ${STUB_EMU_VBIN} ${STUB_SIM_VBIN}) | ||
|
|
||
| macro(add_vrt_vbin_test test_name test_source) | ||
| add_executable(${test_name} ${test_source}) | ||
| target_link_libraries(${test_name} PRIVATE GTest::gtest_main GTest::gmock vrt::vrt) | ||
| target_compile_definitions(${test_name} PRIVATE | ||
| STUB_EMU_VBIN_PATH="${STUB_EMU_VBIN}" | ||
| STUB_SIM_VBIN_PATH="${STUB_SIM_VBIN}") | ||
| add_dependencies(${test_name} stub_vbins) | ||
| gtest_discover_tests(${test_name}) | ||
| add_dependencies(unit_tests ${test_name}) | ||
| endmacro() | ||
|
|
||
| add_vrt_vbin_test(vrtbin_integration_test vrtbin_integration_test.cpp) | ||
| add_vrt_vbin_test(device_test device_test.cpp) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is AVED added as submodule here? I thought we already carried AVED as submodule for firmware/shell builds