Skip to content

Module test hardening: tests/<lib>/ suites, conversion module, export fixes - #5

Draft
ZheFeng7110 wants to merge 9 commits into
mcpplibs:mainfrom
ZheFeng7110:test/module-test-hardening
Draft

ZheFeng7110 wants to merge 9 commits into
mcpplibs:mainfrom
ZheFeng7110:test/module-test-hardening

Conversation

@ZheFeng7110

Copy link
Copy Markdown
Collaborator

Implements .agents/docs/2026-11-09-module-test-hardening-design.md (draft: work in progress, opened to run CI on all hosts).

Wrapper changes

  • Boost.Conversion is a module (mcpplibs.mwrap.boost.conversion). Its headers sit at the top of boost/, so the prefix heuristic saw no headers and the casts were exported by range/graph. EXTRA_HEADERS in tools/boost_common.py gives it its header set, ownership and include edges; pointer_cast.hpp is owned by smart_ptr.
  • boost::core::string_view is exported by core (its only header is boost/core/detail/string_view.hpp; no module exported the alias before).
  • convert exports its converters (cnv::cstream, cnv::lexical_cast, cnv::strtol, cnv::printf, cnv::charconv): the converter headers are not self-contained and had been dropped by the standalone-compile filter.
  • Patches: algorithm.patch (upstream include-guard bug hid transform_reduce), convert.patch (throw_on_failure had internal linkage), bimap.patch (_key/_data were TU-local).

Tests

  • tests/<lib>/ for 34 libraries; doctest from mcpp-index (compat.doctest, [dev-dependencies]).
  • coverage.toml per library maps every example and documentation snippet of the 1.92.0 release to a test case or a reason; tools/ci/test_coverage.py scan|link|check.
  • tests/dll/ and tests/test/utf/ are test projects of their own.

Done so far: algorithm, any, bimap, bloom, callable_traits, charconv, circular_buffer, compat, container_hash, conversion, convert, core, crc, describe, dynamic_bitset, uuid, variant2. Remaining libraries and the CI steps for the sub-projects and the coverage check follow in this PR.

… transform_reduce include guard

The prefix heuristic saw no headers for conversion (its headers sit at the
top of boost/), so the library had no module and its casts were exported
by range and graph. EXTRA_HEADERS gives it its three headers, ownership and
include edges; pointer_cast.hpp is smart_ptr's so conversion does not claim
smart_ptr's names. range, graph and statechart now import the conversion
module instead of re-exporting the casts.

core's header set adds boost/core/detail/string_view.hpp, the only header of
the documented boost::core::string_view; no module exported the alias
before (json exported only basic_string_view).

patches/algorithm.patch: transform_inclusive_scan.hpp reused the include
guard of transform_reduce.hpp, so transform_reduce was missing from the
algorithm module and from any TU that includes both headers.

mcpp.toml also gains [dev-dependencies] compat.doctest and the [test]
discover globs of the test hardening.
…octest suites

Each library of the hardening gets tests/<lib>/ (smoke.cpp is the former
tests/<lib>.cpp); examples*.cpp port the official examples, api*.cpp the
documented components, custom_types.cpp the user-type suite, and
include_*.cpp the macro API as plain #include TUs. coverage.toml maps every
example and documentation snippet of the 1.92.0 release to a test case or
a reason (tools/ci/test_coverage.py scan/link/check).

First libraries: algorithm, any, callable_traits, charconv, circular_buffer,
compat, conversion, core, crc, dynamic_bitset, variant2.

tests/dll/ and tests/test/utf/ are test projects of their own (plugins; the
compiled Boost.Test form), excluded from the root [test] discover.
…container_hash, convert

The converter headers (stream, lexical_cast, strtol, printf, charconv) are
not self-contained, so the standalone-compile filter had dropped them and
the convert module exported convert() without a converter. They now follow
<boost/convert.hpp> in an explicit GMF ([convert] in export_policy.toml);
spirit.hpp stays header-only (it would make Spirit's whole surface
convert's). Four boost::parameter internals that graph and heap exported
move to convert, which now reaches Boost.Parameter first.

patches/convert.patch makes boost::throw_on_failure inline constexpr: as a
namespace-scope const object it had internal linkage and could not be
exported.

New suites: uuid (every documented component), container_hash (official
examples; described classes through the module and as headers), convert
(examples grouped by the default converter they define, user converters).
…l examples

patches/bimap.patch turns the anonymous-namespace references of
boost/bimap/support/lambda.hpp into inline constexpr (as lambda's _1), so
the bimap module exports them.

The examples run as doctest cases whose output must equal the original
program's, built from upstream/boost alone with clang++; examples that
combine bimap with assign, lambda, property_map, range or serialization use
those modules, and the foreach / typeof / xpressive ones are a pure-include
TU. api.cpp covers the inline tutorial code, custom_types.cpp user keys,
comparators, hashers, tags and info payloads.
…an output oracle

bloom: the tutorial section by section, every subfilter, user hashers and
allocator; genome.cpp runs the k-mer example on a FASTA fixture instead of
the 140 MB download. describe: all non-fmt examples (the json and
serialization ones with the BOOST_DESCRIBE_* macros included before the
module imports) and the class/enum pages over user types. container_hash:
every customization point (hash_value by ADL, boost::hash specialization,
is_range / is_tuple_like / is_unordered_range).

Ported example programs compare their output with an oracle: the same
ported code compiled from upstream/boost headers alone with clang++.
test_coverage.py link also maps <page>#example_<stem> sections to the
example's case.
patches/container.patch: boost/container/pmr/devector.hpp reused the include
guard of pmr/vector.hpp, so the module (whose GMF includes devector first)
never exported boost::container::pmr::vector / vector_of.

The 19 examples (output oracle), the documentation's inline code (hub,
devector, stable_vector, pmr, const-reference parameters, null iterators),
user types, options and a user memory_resource. doc_extended_allocators is
recorded as a gap: the package does not build the dlmalloc TUs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant