Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CODING-GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8683,6 +8683,27 @@ increments 1 and 2, whose state is first.
a target the lane does not run says "not measured yet".
Source: `libraries/crypto/openspec/changes/genesis/reference/spec.md`
sections 3.2 and 8.3 (proposals); `test/constant_time/Jamfile` (libs/crypto).
- **dudect's two classes differ in the secret's bytes alone, and a runner
GitHub hosts prints dudect's |t| without judging it (ruling of
2026-11-20).** The CI's first x86-64 runs failed `equal` at |t| 21 to 25
and once ChaCha20-Poly1305's seal at 10.7. No secret branch or index was in
clang 18's x86-64 code of either, and memcheck passed on it; the cause was
the harness: its preparation copied class 0's input from the fixed array and
class 1's from bytes just drawn, still in the store buffer, and the measured
call inherited the difference whatever it computed (|t| 31 to 56 on `equal`
on an Intel Xeon 6975P-C, 28 to 85 on the seal on AMD EPYC 9V45 and 9V74,
up to 117 on a measured call that does nothing with every processor busy).
`choose` now reads both and writes the secret with the same instructions
for either class: 23 runs of 24 then stayed below 4.4 on three processors,
idle and busy, and one read 69.8, on both seeds, on a case below 4.4
everywhere else. A hosted runner is a virtual machine shared with other
tenants whose processor changes from run to run, so a verdict there would
pass or fail with the machine drawn: there the lane prints dudect's |t| and
judges memcheck, MemorySanitizer and `dudect_planted`; dudect is judged on
a machine of one's own. A rerun is never the answer to a red dudect: it
is a leak to fix or a measurement to explain.
Source: `libs/crypto/test/constant_time/dudect.hpp` (`choose`, `judged`)
and `doc/backends.adoc` (libs/crypto).

**Sizes and throughput (increment 1, Task 11'; merged).**

Expand Down
33 changes: 25 additions & 8 deletions tools/report/lanes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
lane is built. A lane is named after the target that toolset builds for (native, emscripten,
wasip2, wasip3), or after that directory (clang-darwin-21, gcc-15). A library's own lane on a
target, which webcpp.lane declares, is named <target>.<library>.<lane> (wasip2.wasi.http): its
toolset builds for that target, and it lists the tests of that library alone.
toolset builds for that target, and it lists the tests of that library alone. An own lane may
build size tables alone (<name>.sizes.md, webcpp.program-sizes), which count as what it built.

The paths in a file are those of the machine that ran the lane, a CI runner as often as not, and
are never opened: they are matched as text, a backslash read as a slash.
Expand Down Expand Up @@ -58,7 +59,11 @@
# the CI knows (tools/ci/matrix.py): spelled here alone.
TARGETS = ('native', 'emscripten', 'wasip2', 'wasip3')

EMPTY = 'the lane built no test and no example'
EMPTY = 'the lane built no test, no example and no size table'

# The file of a size table, which webcpp.size-table and webcpp.program-sizes write
# (tools/webcpp.jam) and an own lane may build alone, as crypto's sizes does: <name>.sizes.md.
SIZE_TABLE = '.sizes.md'

# What a lane that built something says of a library none of whose programs it built.
UNBUILT = 'the lane built none of its tests and examples'
Expand Down Expand Up @@ -166,22 +171,27 @@ class Lane:
rows: dict[str, Row] = field(default_factory=dict)
# The actions that failed and built no file of a test or an example.
outside: list[Action] = field(default_factory=list)
# The size tables the lane wrote, by library: the file of each, as b2 records it.
tables: dict[str, list[str]] = field(default_factory=dict)

def built(self) -> bool:
"""Whether the lane built a test or an example. An example counts: a library may declare
a target for its examples alone, and the lane then tests what it declares."""
return any(row.builds for row in self.rows.values())
"""Whether the lane built a test, an example or a size table. An example counts: a
library may declare a target for its examples alone, and the lane then tests what it
declares. A size table counts: an own lane may build size tables alone, whose programs
are no tests, and a failure to build one is an action outside every test."""
return any(row.builds for row in self.rows.values()) or bool(self.tables)

def unbuilt(self) -> list[str]:
"""The libraries whose tests and examples the lane lists and none of which it built,
sorted; none when the lane built nothing at all, which is a failure of its own. The CI
"""The libraries whose tests and examples the lane lists and none of which it built, nor
a size table of theirs, sorted; none when the lane built nothing at all, which is a
failure of its own. The CI
puts in a lane only the libraries that declare its target, so such a library is a fault
that a grey column would hide: a plan gone wrong, or a local lane that names a library
which does not declare the lane's target."""
if not self.built():
return []
listed = {row.library for row in self.rows.values()}
built = {row.library for row in self.rows.values() if row.builds}
built = {row.library for row in self.rows.values() if row.builds} | set(self.tables)
return sorted(listed - built)


Expand Down Expand Up @@ -340,6 +350,8 @@ def row(location: str, example: bool, row_name: str, row_type: str) -> tuple[Row
# example, its <name>.output, in <location>/<toolset>/...
toolsets: set[str] = set()
owners: dict[str, list[Build]] = {}
# The file of each size table b2 generated, and its library.
tables: dict[str, str] = {}
# A test's own directory, <location>/<target>.test/<toolset>/..., holds nothing of another
# test: an action b2 records under a file there that no target needs is the test's, as MSVC's
# link, which writes the program and its .pdb at once and is recorded under the .pdb.
Expand All @@ -356,6 +368,9 @@ def row(location: str, example: bool, row_name: str, row_type: str) -> tuple[Row
raise InputError(f'{path}: b2 built {target}, which no <test> lists: run b2 with '
'--dump-tests')
else:
library = IN_LIBRARY.fullmatch(under_root(directory, location))
if file.endswith(SIZE_TABLE) and library is not None:
tables[posixpath.join(built_in, file)] = library.group(1)
continue
if toolset is None:
raise InputError(f'{path}: {built_in}, where b2 built {target}, names no toolset')
Expand Down Expand Up @@ -412,6 +427,8 @@ def row(location: str, example: bool, row_name: str, row_type: str) -> tuple[Row
build.actions.append(action)
if not builds and action.status != 0:
lane.outside.append(action)
if action.status == 0 and action.path in tables:
lane.tables.setdefault(tables[action.path], []).append(action.path)

for found in lane.rows.values():
expects = found.type[:-len('-fail')] if found.type.endswith('-fail') else None
Expand Down
18 changes: 18 additions & 0 deletions tools/report/record_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ def plant_native_only(root: Path) -> None:
{'works.cpp': 'int main() { return 0; }\n'})


def plant_sized(root: Path) -> None:
"""Adds the library sized, whose own lane sizes builds a size table of two programs, as
crypto's does (libs/crypto/test/sizes/Jamfile): the table, no test and no example."""
harness.add_library(root, 'sized',
'import webcpp ;\n'
'\n'
'webcpp.targets native ;\n'
'\n'
'webcpp.link baseline : baseline.cpp ;\n'
'webcpp.link answer : answer.cpp ;\n'
'webcpp.program-sizes sized : baseline : answer ;\n'
'webcpp.lane sizes : sized.sizes.md : native ;\n',
{'baseline.cpp': 'int main() { return 0; }\n',
'answer.cpp': '#include <cstdio>\n\nint main() { std::puts("42"); }\n'})


def plant_broken_boost_json(root: Path) -> None:
"""Breaks tools/boost_json.cpp, Boost.JSON's definitions, which every program that parses JSON
links."""
Expand Down Expand Up @@ -174,6 +190,8 @@ class Sample:
# A dependency outside every test fails: Boost.JSON's definitions, which parses_json links.
'wasip2-dependency': Sample(WASIP2, ('libs/demo/test//parses_json',),
plant_broken_boost_json),
# An own lane that builds a size table alone: its programs, and no test and no example.
'native-sizes': Sample(NATIVE, ('libs/sized/test//sizes',), plant_sized),
# A failure whose output b2 writes into CDATA unescaped.
'native-odd-output': Sample(NATIVE, ('libs/odd/test//prints',), plant_odd_output),
# component_demo's tests on wasip2, its served component among them: all pass.
Expand Down
49 changes: 40 additions & 9 deletions tools/report/report_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
lane whose name says another target than its toolset builds for, among them), a failure outside
every test, output that b2's XML cannot hold, and a served component's test that passes and one
whose transcript differs, a run failure, and a library's own lane on a target, named after the
target and the library, which its column and its failures show and which it must hold true; an
emscripten lane, its link-only program a link test, and a driven test whose driver fails, a run
failure. One case uses lanes.py and pages.py alone, and one reads a link that MSVC's lane records
under the program's .pdb; one checks that no sample names the machine's
target and the library, which its column and its failures show and which it must hold true, and
one that builds a size table alone, which is not empty; an emscripten lane, its link-only
program a link test, and a driven test whose driver fails, a run failure. One case uses lanes.py
and pages.py alone, and one reads a link that MSVC's lane records under the program's .pdb; one
checks that no sample names the machine's
temporary directory, and one that none holds what Emscripten says of its cache; a last one records
every sample afresh, untrimmed, and checks that the report reads it as it reads the committed one.
Every page written is checked to be self-contained, to link only to the report's own pages, to the
Expand Down Expand Up @@ -354,12 +355,13 @@ def test_empty_lane_exits_1_naming_it(root: Path) -> None:
out = root / 'alone'
result = report(out, ('wasip2', sample('wasip2-empty')))
assert result.returncode == 1, outcome(result)
assert 'wasip2: the lane built no test and no example' in result.stderr, outcome(result)
empty = 'wasip2: the lane built no test, no example and no size table'
assert empty in result.stderr, outcome(result)
check_pages(out)
out = root / 'beside'
result = report(out, ('native', sample('native-pass')), ('wasip2', sample('wasip2-empty')))
assert result.returncode == 1, outcome(result)
named = 'report: wasip2: the lane built no test and no example'
named = f'report: {empty}'
assert result.stderr.splitlines() == [named], outcome(result)
index = matrix(out / 'index.html')
assert index.names() == ['Library', 'native', 'wasip2'], index.names()
Expand All @@ -377,7 +379,7 @@ def test_empty_lane_exits_1_naming_it(root: Path) -> None:
assert index.verdict('nativeonly', 'wasip2') == 'n/a'
# Every page names the empty lane: a library's page, too.
for page in ('index.html', 'demo.html', 'nativeonly.html'):
assert 'wasip2: the lane built no test and no example' in Page(out / page).text, page
assert empty in Page(out / page).text, page
nativeonly = matrix(out / 'nativeonly.html')
assert nativeonly.rows() == {'works'}, nativeonly.rows()
assert nativeonly.verdict('works', 'wasip2') == 'n/a'
Expand Down Expand Up @@ -595,8 +597,8 @@ def test_a_lane_is_what_its_name_says(root: Path) -> None:
# fails as empty.
result = report(root / 'out-empty', ('clang-darwin-wasip2', sample('wasip2-empty')))
assert result.returncode == 1, outcome(result)
assert 'clang-darwin-wasip2: the lane built no test and no example' in result.stderr, (
outcome(result))
assert ('clang-darwin-wasip2: the lane built no test, no example and no size table'
in result.stderr), outcome(result)


def test_an_own_lane_is_named_after_its_target_and_library(root: Path) -> None:
Expand Down Expand Up @@ -657,6 +659,34 @@ def test_an_own_lane_is_named_after_its_target_and_library(root: Path) -> None:
result.stderr), outcome(result)


def test_an_own_lane_that_builds_a_size_table_built_something(root: Path) -> None:
# An own lane may build size tables alone (webcpp.program-sizes, crypto's sizes): no test and
# no example, its programs not tests, and the table what it built. --dump-tests still lists
# the library's tests, none of which the lane built; neither the lane nor its library is
# empty.
own = 'native.sized.sizes'
out = root / 'report'
result = report(out, (own, sample('native-sizes')))
assert result.returncode == 0, outcome(result)
assert result.stderr == '', outcome(result)
index = matrix(out / 'index.html')
assert 'empty' not in index.columns[1].classes, index.columns
assert index.verdict('sized', own) == 'n/a'
check_pages(out)
lane = lanes.read_lane(own, sample('native-sizes'))
assert lane.built(), lane
assert lane.unbuilt() == [], lane.unbuilt()
assert lane.tables == {'sized': ['bin/libs/sized/test/clang-darwin-21/release/'
'cxxstd-20-iso/sized.sizes.md']}, lane.tables
assert lanes.exit_status([lane]) == 0
# A lane that built neither is still empty, and says so with the table among what it
# did not build.
result = report(root / 'empty', ('wasip2', sample('wasip2-empty')))
assert result.returncode == 1, outcome(result)
assert result.stderr.splitlines() == [
'report: wasip2: the lane built no test, no example and no size table'], outcome(result)


def test_a_failure_outside_every_test_fails_the_lane(root: Path) -> None:
# Boost.JSON's definitions, tools/boost_json.cpp, which parses_json links, do not compile: the
# action is no test's, and parses_json is compiled but never linked nor run.
Expand Down Expand Up @@ -1004,6 +1034,7 @@ def test_samples_read_as_b2_writes_them_today(root: Path) -> None:
test_unreadable_xml_exits_2,
test_a_lane_is_what_its_name_says,
test_an_own_lane_is_named_after_its_target_and_library,
test_an_own_lane_that_builds_a_size_table_built_something,
test_a_failure_outside_every_test_fails_the_lane,
test_an_action_in_a_tests_own_directory_is_the_tests,
test_output_cdata_cannot_hold_is_shown,
Expand Down
1 change: 1 addition & 0 deletions tools/report/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ script checks no sample names.
| `wasip2-empty.xml` | `toolset=clang-wasip2 testing.launcher=wasmtime` | `libs/nativeonly/test`, a library that declares native only | a lane in which every program is skipped |
| `wasip2-skipped-library.xml` | `toolset=clang-wasip2 testing.launcher=wasmtime` | `libs/demo/test libs/demo/example libs/nativeonly/test` | two libraries in one lane, one of which declares native only: demo's programs pass, and every program of nativeonly is skipped |
| `wasip2-dependency.xml` | `toolset=clang-wasip2 testing.launcher=wasmtime` | demo's `parses_json`, with `tools/boost_json.cpp` broken | a failure outside every test, and the test it keeps from running: Boost.JSON's definitions, which `parses_json` links |
| `native-sizes.xml` | `toolset=clang` | `libs/sized/test//sizes`, an own lane over a size table | a lane that builds a size table of two programs (`webcpp.program-sizes`) and no test and no example, as crypto's `sizes` does; recorded on 2026-11-20 with B2 5.5.3 and Apple clang 21 |
| `native-odd-output.xml` | `toolset=clang` | `libs/odd/test//prints` | a failure whose output holds `]]>`, markup and a byte that is not UTF-8, which b2 writes into its CDATA as they are |
| `wasip2-served.xml` | `toolset=clang-wasip2 testing.launcher=wasmtime` | `libs/component_demo/test` | component_demo's tests passing, among them `answers`, an HTTP component that `webcpp.serve` builds, serves with wasmtime and checks, a test of type `serve` |
| `wasip2-served-failure.xml` | `toolset=clang-wasip2 testing.launcher=wasmtime` | `libs/component_demo/test`, with `answers.expected` saying 405 where the component answers 404 | a served test whose transcript differs: a run failure, whose output holds the diff and what wasmtime wrote |
Expand Down
Loading
Loading