ctest: add support for modules - #5459
Draft
dybucc wants to merge 7 commits into
Draft
Conversation
dybucc
force-pushed
the
feature/ctest-specific-modules
branch
8 times, most recently
from
September 4, 2026 13:55
a848a8c to
1e19045
Compare
Add support for parsing modules in the input Rust crate to `ctest`. This should allow more easily implementing support for a number of recent feature additions that have been needed in `libc`.
Add support in `TranslationHelper` to filter out modules based off of a new type of skip accepted in `TestGenerator`'s public API. Filtering containing items is done by filtering on stringified paths (e.g. `foo::bar` to skip function `bar` inside top-level module `crate::foo`.)
dybucc
force-pushed
the
feature/ctest-specific-modules
branch
from
September 5, 2026 11:20
060d0cc to
2e69844
Compare
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.
Description
Add support for (currently) parsing and filtering Rust modules found in
the target crate to test. This is supposed to provide scaffolding for
multiple open feature requests that depend on ctest having support for
modules.
I decided to open this before finishing up work on generating proper
tests on both C and Rust sides, because I am not sure if I should just
let the user deal with including a cohesive set of modules that do not
cause item resolution conflicts, or if I should instead generate
separate tests for each parsed module.
Edit: the above paragraph really goes to say that I am not sure
whether I should generate multiple test templates while recursing
through the modules in
TestGenerator::generate_files, or if I shouldinstead recurse through them in
TestTemplate::new(with the passedFfiItems) and return a collection of test templates for each parsedmodule that has not been skipped.
cc @tgross35 @mbyx
Update
I have changed the way we parse item identifiers, and more specifically,
their absolute paths without
crateat the start (e.g.foo::bar::ctime()instead ofcrate::foo::bar::ctime().)This should make filtering continue working as-is right now for items,
but allow filtering on items in nested submodules by using an
appropriate string matching something like the above example.
Checklist
ctest/testsandctest/src/tests.rshave beenupdated
LIBC_BLESS=1 cargo test -p ctest);@rustbot label +stable-nominated