Skip to content

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

Merged
ZheFeng7110 merged 53 commits into
mcpplibs:mainfrom
ZheFeng7110:test/module-test-hardening
Nov 21, 2026
Merged

ZheFeng7110 merged 53 commits into
mcpplibs:mainfrom
ZheFeng7110:test/module-test-hardening

Conversation

@ZheFeng7110

@ZheFeng7110 ZheFeng7110 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Implements .agents/docs/2026-11-09-module-test-hardening-design.md: the 34 most popular libraries get test suites that cover every official example and documentation snippet of the 1.92.0 release, and the defects those tests found in the wrapper are fixed.

Tests

  • tests/<lib>/ for 34 libraries: algorithm, any, asio, beast, bimap, bloom, callable_traits, charconv, circular_buffer, cobalt, compat, container, container_hash, context, conversion, convert, core, coroutine2, crc, decimal, describe, dll, dynamic_bitset, geometry, hash2, json, math, mqtt5, regex, test, unordered, url, uuid, variant2. The former tests/<lib>.cpp smoke test is tests/<lib>/smoke.cpp.
  • doctest comes from mcpp-index (compat.doctest in [dev-dependencies], so consumers never see it).
  • Official examples are ported mechanically and compared against an output oracle: the same ported code built from upstream/boost headers alone with clang++. asio, beast and mqtt5 examples run over loopback in one process (mqtt5 against an in-process broker).
  • Documentation sections, user types and customization points have their own cases.
  • coverage.toml per library maps every example and documentation section to a test case or a reason. tools/ci/test_coverage.py scan|link|check maintains it.
  • The porting and regeneration scripts are in tools/port_tests/, so the suites can be regenerated when Boost is upgraded.
  • tests/dll/ (plugin shared libraries) and tests/test/utf/ (the compiled Boost.Test form) are separate projects. They are members of the root workspace, so CI runs them with mcpp test -p <member> and reuses the root build's objects and BMIs.

Wrapper changes found by the tests

Library Problem Fix
conversion its headers sit at the top of boost/, so it had no module and range/graph exported the casts new module mcpplibs.mwrap.boost.conversion (EXTRA_HEADERS in tools/boost_common.py); range, graph and statechart export import it, so existing imports keep working
core boost::core::string_view was exported by no module core.cppm includes core/detail/string_view.hpp
algorithm, container upstream include-guard collisions hid transform_reduce and pmr::vector algorithm.patch, container.patch
convert, bimap, url, json, interprocess, math, cobalt, config namespace-scope constexpr objects were TU-local and could not be exported patches make them inline constexpr / BOOST_INLINE_CONSTEXPR
regex internal-linkage message tables were empty in module consumers on gcc regex.patch makes them inline constexpr
convert, asio headers that are not self-contained (converters, use_promise) were dropped by the standalone-compile filter explicit GMF / header entries in the policy
container the placement operator new(..., boost_container_new_t) was unreachable at instantiation exported on gcc; clang facades name it in the purview
decimal the std::formatter specializations were unreachable GMF starts with <version>, purview names them
beast, asio, dll namespace aliases, using-only namespaces and using-directives are not collected by the generator policy extra entries
geometry, variant ambiguous adaptations, missing svg_mapper, a gcc 16 ICE on an anonymous struct policy GMF / drop, variant.patch
thread, serialization three stray dllexports made mcpp's Windows auto-export emit an empty .def thread.patch, serialization.patch
math ooura_fourier_cos returned NaN on musl aarch64 (upstream bug exposed by musl's long double libm) math.patch

Every change was regenerated and passes verify_generated.py. Details and the upstream bugs are in .agents/docs/2026-11-12-module-tests-findings-and-upstream-bugs-analysis.md.

CI and tooling

  • New example coverage job runs test_coverage.py check.
  • Group A gains conversion and a step that tests the two sub-projects. tests/dll is skipped on the static musl arm64 target, which cannot load plugins.
  • The mcpp pin moves to 2026.11.20.1 (feature macros ordered by name, dev-dependencies reaching only test units).
  • The pull_request path filter now matches files under upstream/boost/ (it matched only a file of that name).

Known gaps

@ZheFeng7110 ZheFeng7110 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

中等强度代码审查(/code-review medium)。共 8 条意见,前两条为导出归属回归,建议合并前修复;其余为新脚本的解析缺陷、未记录的 API 变更、依赖与 CI 开销、死代码。

Comment thread tools/boost_common.py Resolved
Comment thread generated/exports/heap.inc Resolved
Comment thread tools/ci/test_coverage.py Resolved
Comment thread tools/ci/test_coverage.py Resolved
Comment thread generated/exports/core.inc Resolved
Comment thread mcpp.toml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread tools/ci/test_coverage.py Resolved
ZheFeng7110 added a commit to ZheFeng7110/boost-m that referenced this pull request Nov 11, 2026
- smart_ptr owns boost/pointer_cast.hpp in its GMF (EXTRA_HEADERS +
  libs.json), so the raw-pointer / std::unique_ptr / std::shared_ptr
  overloads of *_pointer_cast are exported again (by smart_ptr); ownership
  alone had left them exported by no module. Regression case in
  tests/conversion/api.cpp.
- export_policy: heap and graph re-export the Boost.Parameter names their
  named-parameter APIs rest on (convert's wider GMF had claimed them).
- export_policy [convert]: why the math edge is kept (pass-2 body edge).
- docs/usage.md: core does not export boost::size (ambiguity with Range).
- tools/ci/test_coverage.py: qbk sections keep their own body across nested
  sections; `----` is a fence only in .adoc; dead SUBPROJECTS / top removed.
ZheFeng7110 added a commit to ZheFeng7110/boost-m that referenced this pull request Nov 12, 2026
What PR mcpplibs#5's suites found that main already had (checked against
origin/main's exports), what remains open, and the upstream Boost
problems they surfaced, each checked against 1.93.0.beta1 rc1
(f976a2b, built and run with clang 23 on both releases) and the
upstream trackers: only container's include guard, decimal's
logb/ilogb and decimal's documentation names are fixed there; the
algorithm include guard is boostorg/algorithm#136. Also records two
wrong exclusion reasons in tests/math/coverage.toml and Boost.Math's
own module in 1.93.
@ZheFeng7110
ZheFeng7110 force-pushed the test/module-test-hardening branch from fa2f6ad to bc7a2a8 Compare November 18, 2026 13:14
… 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.
…ings); regex suite

patches/regex.patch (M5) had moved the function-local static tables of
regex_traits_defaults.hpp to namespace-scope arrays with internal linkage.
In a TU that imports the regex module, gcc gives those tables a local,
uninitialized copy: get_default_error_string() returned nullptr and every
invalid expression threw std::logic_error (string from null) instead of
regex_error; collating names ([[.space.]]) failed alike. The tables are
inline constexpr now: external linkage and COMDAT, so the original
multiple-definition problem stays solved.

Suite: 17 examples (fixture files on the command line, fixed stdin, grep
over program_options), the reference pages' inline examples, user traits,
iterators, allocators, formatters and grep callbacks.
…url suite

patches/url.patch: Boost.URL's character sets and grammar rules
(grammar::alnum_chars, digit_chars, unreserved_chars, uri_rule,
authority_rule, ...) were namespace-scope constexpr objects, which have
internal linkage and cannot be exported; the url module lacked all 19. They
are BOOST_INLINE_CONSTEXPR now, as upstream already spells
absolute_uri_rule.

Suite: the six command-line examples (output oracle, documented arguments,
fixtures), the documentation's unit files (snippets, grammar, 3_urls) run
through a doctest shim of Boost.URL's test macros, and user rules, charsets
and string tokens.
patches/json.patch: BOOST_JSON_INLINE_VARIABLE declared object_kind,
array_kind and string_kind as references in an anonymous namespace; they
are inline constexpr now, so the json module exports them.

container: allocator_traits::construct uses the global
operator new(std::size_t, void*, boost_container_new_t); a consumer that
instantiates it (pmr::vector<json::value>::resize) could not see it. The
policy exports the tag and the placement operators, and gen_exports.py
accepts namespace = "" (the global namespace) for [[<lib>.extra]].

Suite: the json documentation's code files (test/snippets.cpp and
doc_*.cpp, which the pages include) through a doctest shim, the examples
(output oracle; the parse_into* timing benchmarks excluded), user types via
tag_invoke and contexts, described types (describe headers + json module).
…temp paths)

The MSVC ABI compresses one empty base only, so two sizeof checks of
empty_value hold elsewhere; demangled names are matched in a form both ABIs
print; describe's string_to_enum output (a typeid name) is compared off
MSVC only; and the ported command-line examples name their fixtures
relative to the temporary directory, which they make current, since the
output prints the path (macOS's temporary directory is not /tmp).
The decimal facade's GMF declared no std::formatter specializations:
boost/decimal/format.hpp provides them only when __cpp_lib_format is
defined, and nothing had included <version> yet. The GMF now starts with
<version>, and unexported aliases in the purview name the six
specializations so a consumer's std::format reaches them.

Suite: the examples (output oracle; configuration macros taken from the
headers that define them), the six type pages section by section, cmath /
charconv / strings / cfenv / format pages (several of the pages' names and
values differ from 1.92 and are noted), and user generic code, a money
type and decimal keys.
…pages)

- asio: the self-contained examples (cpp11/14/20) and the network ones over
  loopback in one process (servers in a background thread against a harness
  client, clients against their ported server), the overview pages and the
  requirements pages as user types (completion token, buffer sequences,
  executor, services, random-access devices); 171 examples covered, 18
  excluded with reasons (ssl, spawn, windows, fork, icmp, multicast, ...)
- asio module: export experimental::use_promise (use_promise.hpp is not
  self-contained upstream, so the standalone filter had dropped it) and the
  stream_errc / socket_errc namespaces (using-declarations only)
- regex: the POSIX C API, basic/extended syntax and error_type pages
- convert: the remaining pages, plus a transforming converter (other.qbk)
- test_coverage.py: quickbook code blocks are indented by any amount, not
  4+ spaces; inventories rescanned
Progress per library, where the implementation departs from the design,
the methods used (example ports with an output oracle, loopback harness),
the wrapper defects the tests found, the open CI failures and the remaining
work.
…ming)

container: the `using ::operator new;` export added for the json docs
re-exports every global operator new; on clang, libc++'s aligned allocation
inside another module's instantiation (tests/statechart.cpp) became
ambiguous. The export is gcc-only now; on clang src/json.cppm names the
placement operator in its purview so it stays reachable from its GMF.

asio: the deferred examples print no-error through ex_message() ("Success";
the C library's text differs on musl, macOS and Windows); the actor benchmark
passes its token 500k times instead of 50M (it timed out on loaded CI
runners); type_erasure/main, connect_pair and the fd-passing pair are
compiled only where asio has POSIX stream descriptors / socketpair /
sendmsg, and the doc case for connect_pair skips Windows.

decimal: `near` is a macro of <windows.h> (renamed close_to); the
decimal_fast128_t -> long double check is skipped where long double has
113 bits — an upstream bug, reproduced from upstream/boost alone with
clang -mlong-double-128.

json: the doc files no longer #include <array> after the imports (MSVC STL
headers cannot be re-included after an import reached them).
…ndows case names

The local/ examples (UNIX domain sockets) are compiled on POSIX systems
only: Windows has AF_UNIX stream sockets but bind fails on the CI hosts
(WSAEOPNOTSUPP). The pipe that stands in for stdin is POSIX-only in every
network file (it returned a descriptor as int). prioritised_handlers'
output depends on whether the accept has completed when the queue first
runs, so it is not compared. On Windows each case's name goes to stderr
before it runs, to tell which case ends a process without a report.
boost/beast/core/error.hpp declares `namespace errc = boost::system::errc;`.
The generator collects entities and a using-declaration cannot name a
namespace alias, so the policy re-declares it in the module.

Suite: the HTTP and WebSocket examples over the loopback interface (output
oracle; harness clients written with Beast: a GET of a document root's
index.html, one WebSocket message), the reference pages' inline code over
beast::test::stream (primer messages, body types, serializer and parser
stream operations, chunked encoding with the page's chunk-callback output,
the RFC 6455 handshake key/accept pair, the Body and BuffersGenerator
concepts), and user types: a Body with reader and writer, Fields with a user
allocator, a DynamicBuffer, and a next layer with its own teardown,
async_teardown and beast_close_socket overloads. SSL examples need OpenSSL,
the coroutine ones asio::spawn (Boost.Context) and two clients public
internet services; they are excluded.
…sed_4

The served index.html is written in binary mode (Windows wrote \r\n and
the Content-Length differed). The local-socket probe stays open like the
TCP one: on macOS an accept of a connection the peer already closed fails
with EINVAL and the beast async-local servers stop. tutorial/timer5 runs two
threads whose timers are due at the same instant, so its output is not
compared; composed_4 ends the process on windows-llvm-msvc (0xC0000374) and is
POSIX-only until that is understood. The oracle reruns a program whose free
port was taken in between.
…t suite

boost/cobalt.hpp includes boost/cobalt/main.hpp, which defines the
program's main as a friend of main_promise. From the module's GMF that
definition reached every importer and clang rejected a consumer's own
`int main(int, char**)`. The facade has cobalt.hpp's headers except
main.hpp (policy gmf); a co_main program includes <boost/cobalt/main.hpp>.

patches/cobalt.patch: use_op, use_task, this_coro::allocator / cancelled /
initial and the cobalt::io protocol constants (tcp_v4, udp, local_stream,
...) were namespace-scope constexpr objects (internal linkage, not
exported); they are inline constexpr. cobalt::this_coro re-exports the
asio::this_coro names its using-directive brings in (policy extra).

Suite: the examples (output oracle against the cobalt sources; co_main
becomes a task<int> run by cobalt::run, echo_server on a free port), the
documentation's code (background, benchmarks, design, primer, tour, push
generator) and user types: an awaitable, an interruptible awaitable in race,
a cobalt::op, move-only results through task/promise/generator/channel/join,
and a user executor for cobalt::spawn.
The examples talk to broker.hivemq.com; here a small MQTT 5 broker of the
test harness (CONNECT, PUBLISH at QoS 0-2, SUBSCRIBE with wildcards and
retained messages, UNSUBSCRIBE, PING, DISCONNECT; TCP or WebSocket) listens
on a free port passed as argv. The programs that run until SIGINT stop as on
SIGINT after their first message or fifth completion. The broker's CONNACK
carries a property: the client reads a property-less CONNACK's remainder with
a zero-size read, which a websocket::stream completes only on the next
frame. The documentation's snippets run against the same broker; user
types: a stream layer with its async_shutdown, a logger, an authenticator.
The TLS examples need OpenSSL and are excluded.
…xes found by the suites

- geometry: GMF without adapted/boost_fusion.hpp (fusion and tuple adaptation
  both visible are ambiguous), with io/svg/svg_mapper.hpp; the facade imports
  algorithm; clang reaches the placement operator new through the facade;
  core drops std::size (ambiguous with boost::size)
- variant.patch: name the struct in has_result_type.hpp (gcc 16 ICE on every
  rtree use)
- interprocess.patch: creation tags, lock options, offset_type_alignment and
  ec_table as BOOST_INLINE_CONSTEXPR (TU-local otherwise)
- math.patch: float/double/long_double_constants and the nonfinite facet flags
  inline constexpr; cubic_roots / line_search_policies name std::sin / fabs
- config_cstdlib.patch + libs.json: boost/cstdlib.hpp in the config module,
  exit_success / exit_failure / ... as BOOST_INLINE_CONSTEXPR
- dll: boost::dll::fs is a using-directive upstream, invisible to importers;
  policy extra re-declares the filesystem names the documentation uses
- cobalt: sctp protocols only where IPPROTO_SCTP exists (Windows)
Official examples ported with output oracles, partitioned so that no two
examples with conflicting registrations share a program; they run in the
temporary directory (svg / data files). api_reference / api_index cover the
documentation pages, custom_types the traits and registration macros.
The 'example coverage' job runs tools/ci/test_coverage.py check; group A of
each host runs mcpp test in tests/dll and tests/test/utf. docs/architecture
describes tests/<lib>/ and the two sub-projects.
- Boost.Test and dll custom types: namespace app, not user (macOS
  <sys/proc.h> declares struct user); numeric_limits (min)/(max) (windows.h)
- geometry/api_reference: close_to, not near (Windows macro)
- math examples: outputs compared on the oracle's platform (x86_64 Linux)
  only; elsewhere long double's width and libm digits differ
- math docs: tgamma(5000) overflows in every type (aarch64's long double);
  the ooura cosine tolerance; daubechies_scaling with an explicit grid;
  naive_monte_carlo with the lambda's type, as the page writes it
- asio parallel_group examples: output compared only where POSIX stream
  descriptors exist (an empty main elsewhere)
- Boost.Test programs: normalise colour codes, 'unknown location', the
  system's memory-fault text and MSVC's class-key in type names; example83's
  std::rand output not compared; sizeof(long) and SIGALRM outputs not
  compared on Windows
- cobalt/doc names each case on Windows (heap corruption ends the process)
- cobalt spsc: its awaitable queue races (await_suspend stores the executor
  and handle unsynchronised with the other thread's post); it crashed on
  aarch64 and can hang. Excluded with the reason.
- cobalt/doc asio-awaitable / a-minimal-executor and math daubechies_scaling
  end the process on windows-llvm-msvc only (heap corruption / SIGSEGV, like
  asio's composed_4): skipped there, an open issue in the design record.
- math ooura cosine: the result must lie within the integrator's own error
  estimate (with the values in the report)
…uble

- cobalt/doc ends with heap corruption on windows-llvm-msvc at a different
  case each run (a-minimal-executor, race): the whole program is skipped
  there (a test-suite decorator), an open issue in the design record
- ooura_fourier_cos<double> returns NaN on aarch64 Linux (its nodes are
  computed in the 113-bit long double): that check is skipped there
…n Windows yet

- asio/api_overview: read the clock before constructing the timer (its
  expiry counts from construction; a loaded runner measured < 5 ms)
- dll/self tutorial9: the function type spelt as the original's typedef
  (clang-cl misparsed the alias)
- CI: tests/dll is not run on Windows: the package built shared does not
  export its compiled sources on PE (undefined boost::filesystem /
  boost::system symbols); open issue in the design record
gcc@16.1.0 on Linux arm64 targets aarch64-linux-musl with a static C
library; a static program cannot load the plugin shared libraries.
§11 records the progress (every library's todo cleared), the deviations
(dll linkage, Boost.Test as whole programs), the wrapper-layer issues the
suites found, the CI timings (§9 Q3: no further test grouping) and the
open issues, which move to todos/module-tests-open-issues.md.
- smart_ptr owns boost/pointer_cast.hpp in its GMF (EXTRA_HEADERS +
  libs.json), so the raw-pointer / std::unique_ptr / std::shared_ptr
  overloads of *_pointer_cast are exported again (by smart_ptr); ownership
  alone had left them exported by no module. Regression case in
  tests/conversion/api.cpp.
- export_policy: heap and graph re-export the Boost.Parameter names their
  named-parameter APIs rest on (convert's wider GMF had claimed them).
- export_policy [convert]: why the math edge is kept (pass-2 body edge).
- docs/usage.md: core does not export boost::size (ambiguity with Range).
- tools/ci/test_coverage.py: qbk sections keep their own body across nested
  sections; `----` is a fence only in .adoc; dead SUBPROJECTS / top removed.
What PR mcpplibs#5's suites found that main already had (checked against
origin/main's exports), what remains open, and the upstream Boost
problems they surfaced, each checked against 1.93.0.beta1 rc1
(f976a2b, built and run with clang 23 on both releases) and the
upstream trackers: only container's include guard, decimal's
logb/ilogb and decimal's documentation names are fixed there; the
algorithm include guard is boostorg/algorithm#136. Also records two
wrong exclusion reasons in tests/math/coverage.toml and Boost.Math's
own module in 1.93.
The generators of the ported upstream tests (port_examples.py, the
per-library regen scripts, the harness headers) were only in the local
.tmp/scripts/. They are now tools/port_tests/, driven by regen.py, which
extracts the pinned release's libs/ into target/port-tests/, applies the
edited example sources (sources/*.patch), builds the oracle libraries and
runs the libraries in parallel, summarising the FLAG lines.

Regenerating reproduces the committed tests/ except the outputs that are
never compiled (#if !(1): timings, dates, thread order) and bloom and
container, which predated the current porter and are regenerated here.
Fixes on the way: several --output-unless of one example nest; math keeps
each example in the file that has it; CLANG_NO_DEFAULT_CONFIG is dropped
for the oracle. test_coverage.py link also matches example: <dir>/<stem>.

Design record 2026-11-18-port-tests-tools-design.md; the todo item is done.
…fects) (#1)

* ci(experiment): reproduce the windows-llvm-msvc crashes under page heap

Builds asio/examples_cpp20, cobalt/doc and math/doc_sf on windows-latest
with the Windows skips removed, prints the effective compile/link flags,
runs each program plainly and then under full page heap in cdb (open
issue 1 of the module tests). Experiment only; dropped before merging.

* ci(experiment): minimal programs, cdb at the heap-corruption stop

tests/zz_repro/: the same std cases (std::async, exception_ptr, promise
set_exception, threads) with textual headers, with import std only and
with the asio module, plus asio's use_future; each case runs in its own
process. The crashing programs run under cdb without page heap so the
0xC0000374 stop shows the freeing stack; the MSVC STL ambient scheduler
definitions are printed. Experiment only.

* ci(experiment): page heap per case, CatchableType and ambient-scheduler symbols

* ci(experiment): llvm 22.1.8 vs 23.1.3, decorated CatchableType names, TU-local throw workaround

* tests: complete the MSVC-ABI CatchableTypes in the TUs that copy exceptions

clang on the MSVC ABI leaves the copy constructor out of the CatchableTypes
it emits for a throw that came from a named module unless the TU checks a
throw of the type itself (clice-io/xclang#27, llvm/llvm-project#114075).
The linker may keep that COMDAT, and an exception_ptr copy (use_future,
cobalt's race/promise) is then bitwise: the message is freed twice
(0xC0000374). The asio port helper and tests/cobalt/doc.cpp now check such
throws in a never-called function; composed_4 and cobalt/doc run on Windows
again. (Experiment programs under tests/zz_repro stay until the branch is
cleaned.)

* tests: composed_4's EINVAL text is the system's; experiment: daubechies import order

* tests: math/doc_sf imports math before std; daubechies_scaling runs on Windows

With std imported first, clang merges MSVC's ppltasks from the std module
and the math module's global fragment so that the call_once lambda of
_GetStaticAmbientSchedulerRef writes a second copy of the function's static
(the symbols differ only by LLVM's .1 suffix); std::async, which
daubechies_scaling uses, then reads a null scheduler. The other import order
does not hit it (llvm 22.1.8 and 23.1.3). The experiment programs are
dropped; the workflow now runs the five programs in full.

* docs: windows-llvm-msvc crashes record; clang-msvc module caveats; drop the experiment

The record (.agents/docs/2026-11-18-windows-msvc-module-crashes-analysis.md)
gives the evidence for both clang defects and the workarounds; the open
issue becomes a follow-up to remove them once clang is fixed. docs/usage
section 5 tells consumers about both. The Windows experiment workflow and
its driver are removed (they live in this branch's history).
…eam loop guard) (#2)

* math: ooura_fourier_cos stops at a non-finite little-node weight

ooura_fourier_cos<double> returned NaN (result and error estimate) on the
linux-gcc-arm64 leg. The leg's C library is musl, whose 113-bit expl,
expm1l and log1pl just call the double versions. On the last little node
of each level exp(-eta) is about 1e450: with a full-range long double the
node and weight both underflow to 0 in double and the loop ends; with
musl it overflows to inf, phi_prime is NaN and the node is 0, which the
cosine loop (it only stops at a negative node, the sine one at node <= 0
or NaN) accepted, so f(0)*NaN poisoned every estimate.

An upstream bug, not a wrapper one: a plain-include program on x86_64
with float128 nodes and double exp/expm1/log1p reproduces it, and
libquadmath's functions do not. patches/math.patch makes the loop stop
at a non-finite weight (the true weight there has already underflowed);
the 113-bit skip in tests/math/doc_numerics.cpp is removed and the open
issue is closed.

* ci(experiment): plain-include ooura_fourier_cos on native aarch64 musl

Experiment only; dropped before merging.

* ci(experiment): also run the ooura musl experiment on push

* trigger ci

* ci(experiment): run the ooura musl build in docker run alpine

JavaScript actions cannot run in an Alpine job container on arm64 runners.

* docs(agents): ooura_fourier_cos NaN confirmed on native aarch64 musl; drop the experiment

The plain-include program in alpine 3.22 on ubuntu-24.04-arm returns NaN
with the pristine header and the correct value with patches/math.patch.
The temporary workflow is removed.
… on Windows (#3)

* ci(experiment): tests/dll on windows-llvm-msvc, auto-export report

* serialization, thread: no declared exports in a static build on Windows; tests/dll runs on Windows

A DLL whose objects declare any export gets no discovered ones from mcpp's
.def (GNU ld's auto-export has the same rule). The shared package DLL of
tests/dll carried three such exports, none tied to a DLL build of Boost:
thread's LNK4221 placeholder, codecvt_null<wchar_t>'s BOOST_SYMBOL_EXPORT and
serialization's BOOST_DLLEXPORT. Its .def came out empty and every
filesystem/system symbol was undefined at the test programs' link.

* docs: tests/dll on Windows resolved; drop the experiment workflow
@ZheFeng7110
ZheFeng7110 force-pushed the test/module-test-hardening branch from c78e207 to 868aefe Compare November 19, 2026 13:53
…026.11.20.1

tests/dll (with its seven plugins) and tests/test/utf become members of the
root workspace. CI runs them from the root with `mcpp test -p <member>` and
the group's features forwarded (`mcpplibs.mwrap.boost/<f>`), so they build in
the root's build directory and reuse the objects and BMIs of `mcpp build`:
10 s + 5 s locally, instead of rebuilding the package (444 s + 471 s on CI).

The reuse needs two mcpp fixes, hence the pin moves 2026.11.5.1 -> 2026.11.20.1:
feature defines ordered by name (2026.11.17.2, mcpp#949) and dev-dependencies
reaching only test units (2026.11.8.1, mcpp#906). The upgrade also brings:

- dependency keys unquoted (`mcpplibs.mwrap.boost = ...`): the quoted dotted
  key is deprecated and refused by --strict; manifests, templates, examples,
  README and usage docs;
- tools/ci/test_template.py: the fixture's MCPP_HOME leaves the working tree
  (a path package is keyed by its tree's digest), the ABI tables are no longer
  linked from the donor home (the new mcpp rewrote and pruned the donor's),
  and the descriptor drops `mcpp = "mcpp.toml"` (matched exactly now).

Design record: .agents/docs/2026-11-20-sub-project-build-reuse-design.md.
"upstream/boost" matched only a file of that name, so a pull request that
changed only the vendored tree did not run the tests; push already used
"upstream/boost/**".
@ZheFeng7110
ZheFeng7110 marked this pull request as ready for review November 20, 2026 11:17

@ZheFeng7110 ZheFeng7110 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

高强度代码审查(/code-review high)。共 9 条意见:1 条重要(cobalt 模块去掉 main 后缺少文档和 co_main 测试,建议合并前处理),其余 8 条为小问题,涉及文档过时、asio 测试辅助代码的稳定性、覆盖率检查误判及开发工具细节。

已验证:32 个 patches/*.patch 均已应用且互不重叠,tools/ci/test_coverage.py check 通过,tools/tests 下 40 个测试通过。未运行 gen_exports.py --check,也未执行任何 mcpp 构建。

Comment thread src/cobalt.cppm Resolved
Comment thread docs/usage.md Resolved
Comment thread tools/port_tests/helpers/asio.hpp Resolved
static bool started = false;
if (std::exchange(started, true))
return;
std::thread([] {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[nit] 看门狗线程在静态析构期间仍访问静态对象

挂起看门狗是一个分离线程,每 5 秒唤醒一次,锁定 ex_case_names::m 并读取 current,没有任何机制停止或 join 它。程序退出时 exit() 会析构 inline static 的 std::string 和 std::mutex,而此时线程可能正在执行 lock_guard 和 current.empty(),导致退出时崩溃或挂起——即使所有用例都通过,程序也会偶发失败。

建议:像这里其他辅助代码处理 io_context 那样,使用函数内的泄漏状态(static auto& s = *new State;),或用 std::quick_exit / atexit 钩子停止循环。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

inline bool ex_no_probe = false; // the server accepts one connection only: do not probe it
inline std::string ex_port;
inline unsigned short ex_port_number() { return static_cast<unsigned short>(std::stoi(ex_port)); }
inline std::string ex_free_port() {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[nit] ex_free_port 存在端口竞争

先绑定端口 0 取得端口号,再在示例程序绑定之前关闭 acceptor,这期间其他进程可能抢占该端口。mcpp test 会并行运行大量 asio、beast 和 mqtt5 程序,每个都这样做。

场景:两个并行的测试程序各自调用 ex_free_port,内核把刚释放的临时端口分配给第二个,第一个示例的 bind 因 address_in_use 失败,或客户端连到了错误的服务器,造成 CI 偶发失败。

建议:保持 acceptor 打开并直接交给示例使用,或在服务端启动遇到 address_in_use 时重试。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

暂时不做——根据 #7 ,考虑用 mtest 代替这个机制。而且上游 mtest 已经适配了 doctest

Comment thread tools/ci/test_coverage.py Resolved
Comment thread tools/boost_common.py Resolved
Comment thread tools/ci/test_template.py Resolved
…t geometry's Fusion adapter removal

docs/usage.md §6 (and usage.zh.md) records that the cobalt module leaves
out boost/cobalt/main.hpp and the geometry module leaves out
geometries/adapted/boost_fusion.hpp, with the consumer pattern for each:
include the header before the import. §2.2 states the include-before-import
rule; both pinned compilers reject the reverse order.
tests/cobalt/co_main.cpp is a co_main program built on every leg.
@ZheFeng7110
ZheFeng7110 merged commit 34d6fc8 into mcpplibs:main Nov 21, 2026
20 checks passed
@ZheFeng7110
ZheFeng7110 deleted the test/module-test-hardening branch November 21, 2026 10:43
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