Repository navigation
Description
Need
The mtest protocol (mcpp docs/specs/test.md, SPEC-017, P2.2) forbids a program that speaks it to pass the protocol variables (MTEST_PROTOCOL, MTEST_MODE, MTEST_REPORT, MTEST_SELECT, ...) to the programs it starts, so that a test program a test starts is not taken for the runner's. mcpp-community/mtest#29 found that the doctest adapter breaks it: a case sees MTEST_REPORT, and a doctest program the case starts appends its events to the parent's report. The GoogleTest adapter and the library (mcpplibs.mtest) read the variables the same way and do not remove them; the library strips them only from the commands e2e::run starts.
A test framework does not control how a case starts a program: os::process::spawn, std::system, posix_spawn, a library's own process class. The variables have to be gone from what each of these inherits once the framework has read them, before any case runs.
What mcpplibs.os states now
src/env.cppm: "a started program's environment is stated when it is started (process::spawn_options), and this program's own is not modified --- part 2 §6.4."- openkal
include/openkal/env.h: "THE SET DOES NOT CHANGE while the program runs." process::spawn_options::env: "a value sets the variable and nothing removes it", so one spawn can leave a name out ({"MTEST_REPORT", std::nullopt}), which is whate2e::rundoes.
So a caller can strip the names from each program it starts itself, but the library has no way for a program to say "the programs I start, by any means, do not get these names", and an env::unset on the program's own environment would contradict both statements above (and, in an ok image, leave env::get and process::spawn still seeing the variables).
Possible shapes (for the maintainers to decide)
env::withhold(names): namesprocess::spawnleaves out of every program it starts unlessspawn_options::envsets them; openkal's set is unchanged. This covers programs started throughmcpplibs.osonly.- A host-side removal from the C library's environment (what
std::system,posix_spawnandstd::getenvsee), chosen at run time insrc/posix/src/windows(unsetenv,_putenv_s(name, "")), stated as not changing openkal's set; with or without 1. - None of these: such removal is out of the library's scope.
Meanwhile
mtest's adapters remove the variables from the C library's environment themselves (they are header-based and outside the rule that mtest's engine and library reach the system only through mcpplibs.os). The library mcpplibs.mtest keeps its current behaviour until this is decided.
Activity
0.11.4: the doctest adapter reports what doctest knows; the protocol'…