Week_2
June 2025 (273 Words, 2 Minutes)
Introduction
Quite a lot of things happened in this week!
As this was by first time contributing to an Open Source project, and as this was the first time I was using git without having rm -rf
as a failsafe (although believe me, I tried), the PR become a little too unstructured, as it added too many new things at once.
But that’s perfectly fine!
We’re here to learn after all, so my big monolith PR was divided into four smaller ones. Of these two have been submitted, and one has been accepted. The process is slow, but the code quality is definitely going up, and the code reviews have been really helpful.
PRs Galore!
- The first PR adds the ability to combine the crate being parsed into a single file with all macros expanded, as well as a stub for testing.
More info on this in the previous blog post.
- The second PR adds cleaned up code for extraction of relevant FFI items for testing purposes, as well as a bunch of tests for making sure they work.
More info on this in the previous blog post.
- The third PR will focus on adding translation of these FFI items into C equivalents to be used for testing the crate, as well as relevant tests.
Of note in this PR is the use of a templating engine to generate tests for both the Rust and C side from a template file. It is quite an interesting idea, to leverage a templating engine that was designed mainly for the web, but it works extremely well here, although things do get cluttered pretty quickly, which some preprocessing in the Rust side should solve.
Other than that, the most difficult aspect was integration tests. Rust heavily depends on cargo
as its build system, so using the rustc
compiler directly for everything, while not impossible, does make things a lot more complicated. Ultimately it was decided to have the bare minimum amount of tests, and that they only run on platforms that aren’t cross compiled. Instead we could port the existing ctest-test
, which is a proper cargo
project and does not create more problems.
- The fourth PR will focus on adding configuration options to these parts, along with relevant tests.
What’s Next?
Meanwhile in a local sandbox I’ve been working out all the code for the other PRs while the second one is being reviewed. Soon I’ll also start research on template engines (like askama) to generate the tests we need, and then we’ll have a minimum viable product ready!