Switched Tests to the preCICE mock from a local Participant.cpp - #260
Draft
JulianHarrison-Wirth wants to merge 3 commits into
Draft
Switched Tests to the preCICE mock from a local Participant.cpp#260JulianHarrison-Wirth wants to merge 3 commits into
JulianHarrison-Wirth wants to merge 3 commits into
Conversation
Author
|
Please Run the Tests again, it should work now |
Member
Done. The tests are now passing. |
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.
Main changes of this PR
Replaces the hand-written mock in
test/Participant.cppwith the universal preCICE mock (libpreciceMocked.so, fromextras/mockin the preCICE repository), and rewrites the test suite around it.test/Participant.cpp(260 lines of stubbed API returning fake values) and theMANIFEST.in/setup.pymachinery that compiled it into the bindings. WithPYPRECICE_MOCKEDset,setup.pynow simply skips linkinglibprecice; the symbols are provided at runtime by preloading the mock.test/precice-config.xml— a real preCICE configuration (scalar/vector read and write data, a provided and a received mesh with API access, just-in-time mappings, a gradient mapping, a projection mapping, and a serial-explicit coupling scheme). The mock parses it and validates every API call against it.tox.inipreloads the mock viaLD_PRELOADfromPRECICE_MOCK_LIBand fails early with a clear message if that variable does not point at an existing library..github/workflows/build-and-test.yml) builds thepreciceMockedtarget from the preCICE checkout instead of copyingParticipant.hpp/Tooling.*out of it, and exportsPRECICE_MOCK_LIB.libxml2-devwas added to the installed packages.read_datareturns whatwrite_datawrote.initialize(), invalid vertex IDs, setting vertices afterinitialize(), advancing beyond the time window), a full simulation loop with subcycling, checkpoint queries, mesh reset/remeshing, just-in-time mapping including the missing-access-region error, and profiling sections.Motivation and additional information
The previous mock was a per-repository stub: it returned fixed values, knew nothing about a preCICE configuration, and therefore could only check that a call compiled and returned the expected constant. Anything configuration-dependent — error handling, coupling-scheme behaviour, correct read/write directions — was untestable, and the stub had to be kept in sync with the API by hand.
The universal mock validates calls against a real configuration and echoes written data back, so the bindings can be tested against behaviour instead of against constants, and the duplicated mock disappears from this repository.
Dependency on the preCICE PR
This depends on precice/precice#XXXX (
extras/mock), which is not merged yet. Until then, the CI workflow clones the mock branch:There is a
TODOnext to it — the workflow must be switched back to--branch develop https://github.com/precice/precice.gitonce the mock is merged upstream. Please do not merge this PR before that is done.Running the tests locally
Reviewers' checklist
test/precice-config.xmlcover the API surface you would expect?LD_PRELOADviaPRECICE_MOCK_LIBan acceptable way to run the suite, or should the mock be discovered automatically?CHANGELOG.mdentry be added under## latest?