Fix tests to work with out of source builds.#1926
Open
Dimi1010 wants to merge 59 commits intoseladb:devfrom
Open
Fix tests to work with out of source builds.#1926Dimi1010 wants to merge 59 commits intoseladb:devfrom
Dimi1010 wants to merge 59 commits intoseladb:devfrom
Conversation
# Conflicts: # .github/workflows/build_and_test.yml # Tests/Packet++Test/main.cpp
Owner
|
@Dimi1010 should we close this PR? |
Collaborator
Author
|
Sure, we can do it for now. |
# Conflicts: # .github/workflows/build_and_test.yml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1926 +/- ##
========================================
Coverage 83.81% 83.81%
========================================
Files 313 313
Lines 55676 55669 -7
Branches 11606 11821 +215
========================================
- Hits 46665 46660 -5
+ Misses 7810 7807 -3
- Partials 1201 1202 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
seladb
reviewed
Jan 9, 2026
Owner
There was a problem hiding this comment.
Ditto: are the changes related to this PR?
Owner
|
@Dimi1010 the reason the coverage tests are failing is a new gcovr version that was released recently. I'm not entirely sure how to fix it, but for now we can pin to the latest version supported by all platforms as I did here |
seladb
approved these changes
Feb 21, 2026
Owner
seladb
left a comment
There was a problem hiding this comment.
Please see one comment, overall LGTM
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR refactors the project to output the PCPP Test executables inside the default output directory and updates the CI
build_and_testworkflow to use the new location.Rationale
The previous implementation used built the test executables within the source directories. The rationale for that was to allow usage of
PcapExamplesfolder inside the test folder for samples. The approach however created several issues with modern build patterns such as multi-config generators like Visual Studio and Ninja Multi-Config. Those solutions rely partially on out of source builds, by having the output artifacts that are config specific be generated in config sub-folders (e.g. Debug, Release, etc).The hardcoded output location of the executable broke functionalities such as the ability to have multiple configuration executables cached. For example switching to a Release config and building would overwrite a previously built Debug target.
The refactor updates the project to output all of its artifacts inside the build directory, keeping the source stable allowing more predictable behaviour when utilizing modern generators.
Changes
Test executable output location change
The test executable output location has been moved to the default location (e.g.
$(buildDir)/Tests/Packet++Test/<Config>/Packet++Test.exe).To keep compatibility the contents of
PcapExamplesare copied next to the executable. A possible future fix is to provide the ability for executable to load test resources from a custom location instead of relying on samples being inside the working directory.Refactor of
run_testsscriptsThe CI run tests python scripts have been refactored to allow for variable locations for build directory and test executables.
The change also introduces a new
Runnerclass that separates most of the logic into smaller functions instead of having a monolith main function, improving readability. Additional logging has also been added to help with runtime debugging.Github Actions workflow update
The
build_and_testworkflow has been updated to utilize the refactoredrun_testsby passing the build directory of the project, and in some cases override on the default relative paths to the test executables.The workflow has also been updated to utilize the
working-directoryparameter on action steps instead of using acd ...command inside shell command of therunparameter.