Skip to content

Conversation

mbyx
Copy link
Contributor

@mbyx mbyx commented Aug 22, 2025

Description

Allows defining values only for certain headers, as well as choosing which language to use when generating tests.

Closes #4598

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot rustbot added ctest Issues relating to the ctest crate S-waiting-on-review labels Aug 22, 2025
@mbyx
Copy link
Contributor Author

mbyx commented Aug 22, 2025

Should we add back in the C++ testing in ctest-test or just add another smaller test to tests?

@mbyx
Copy link
Contributor Author

mbyx commented Aug 22, 2025

FreeBSD is failing in a different way than usual. It might be because HashMap doesn't maintain order of the headers. EDIT: Apparently I can't read docs, BTreeMap also only maintains sorted order not insertion order. Fixed.

@mbyx mbyx force-pushed the ctest-define-and-language branch 2 times, most recently from e019371 to 9555368 Compare August 22, 2025 15:32
Comment on lines 40 to 41
pub headers: Vec<String>,
pub header_defines: HashMap<String, Vec<String>>,
Copy link
Contributor

@tgross35 tgross35 Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of keeping this as separate fields, could headers instead become Vec<(BoxStr, Vec<BoxStr>)>? Or put those two fields into a new struct.

This should also allows the same header to be used more than once with a different set of #defines. Probably not very useful for our purposes, but it does come up in C land.

@tgross35
Copy link
Contributor

tgross35 commented Aug 26, 2025

FreeBSD is failing in a different way than usual. It might be because HashMap doesn't maintain order of the headers. EDIT: Apparently I can't read docs, BTreeMap also only maintains sorted order not insertion order. Fixed.

For reference, this is usually where something like the indexmap crate could be used, e.g. serde has this as an option. But I don't think we really need it, the defines can just be kept in a vector if we don't need to dedupe them #4673 (comment)

@mbyx mbyx force-pushed the ctest-define-and-language branch 2 times, most recently from cb0f2e0 to 95badda Compare August 28, 2025 09:34
@mbyx mbyx requested a review from tgross35 August 28, 2025 09:47
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@tgross35 tgross35 enabled auto-merge August 30, 2025 10:02
@tgross35 tgross35 added this pull request to the merge queue Aug 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Aug 30, 2025
@mbyx mbyx force-pushed the ctest-define-and-language branch from 95badda to 56b05ac Compare August 30, 2025 14:38
@mbyx mbyx requested a review from tgross35 August 30, 2025 14:38
@tgross35 tgross35 added this pull request to the merge queue Sep 1, 2025
Merged via the queue into rust-lang:main with commit 0082796 Sep 1, 2025
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctest Issues relating to the ctest crate S-waiting-on-author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ctest: Allow defining/undefining values for specific headers
3 participants