compiletest: make some internals pub for use as a library#154997
compiletest: make some internals pub for use as a library#154997akintewe wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
15fdf1d to
b750a8b
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
534e6af to
b750a8b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b750a8b to
590c610
Compare
This comment has been minimized.
This comment has been minimized.
Make Config, TestPaths, CollectedTest, CollectedTestDesc, ShouldFail, FileDirectives, parse_config and collect_and_make_tests public so that external tools can depend on compiletest as a library and use its test collection infrastructure directly. r? jackh726
590c610 to
1d43611
Compare
Forward all args to parse_config instead of building a stub config. Extract rustc_path and sysroot from CLI args directly so we don't need to access private Config fields. Also add coverage-tool to the workspace Cargo.toml. Note: requires rust-lang#154997 to merge before Config and related types are publicly accessible from compiletest.
|
In the past, stuff like this has been detrimental to compiletest maintenance, so I'm very reluctant to expose anything beyond the absolute bare minimum needed by other in-tree tools. If you need these details for out-of-tree tools, I'd prefer that the changes be kept in a downstream fork instead, so that they don't burden compiletest itself. |
Thanks for the feedback @Zalathar. The intended use is an in tree tool (src/tools/coverage-tool) that depends on compiletest as a library to collect tests without re implementing bootstrap's test collection logic so the changes would live in tree alongside compiletest, not in a downstream fork. That said, I completely understand the concern about maintenance burden. @jackh726 given this feedback, would it make more sense to keep the coverage tool self contained and duplicate the minimal bits it needs from compiletest instead? |
|
The name I'm not very familiar with your current work, but if the tool is intended to help measure coverage of the compiler itself, it might be wise to communicate that more clearly in the tool's name (e.g. |
Thank you for the suggestion, compiler-coverage-tool is much clearer. I'll rename it. |
Make
Config,TestPaths,CollectedTest,CollectedTestDesc,ShouldFail,FileDirectives,parse_configandcollect_and_make_testspublic so that external tools can depend on compiletest as a library and use its test collection infrastructure directly, without re-implementing parts of bootstrap and compiletest.r? jackh726