From 69bf8ab91ba53c025676cb5dea16dd70a7f681b2 Mon Sep 17 00:00:00 2001 From: R Date: Mon, 16 Nov 2026 15:39:18 -0300 Subject: [PATCH 1/3] tools: size tables and hash's throughput table are built only from release builds webcpp.size-table requires release, which its manifests and their programs inherit whatever the command asks for, and gives variants.py the variant, which refuses any other. libs/hash moves to the commit whose bench/collect.py refuses a program not built at variant=release, and data whose build is not variant=release; tools/test/hash_collect_test.py checks it. --- libs/hash | 2 +- tools/test/emscripten_test.py | 15 ++++ tools/test/hash_collect_test.py | 120 ++++++++++++++++++++++++++++++++ tools/variants/variants.py | 22 ++++-- tools/variants/variants_test.py | 28 ++++++-- tools/webcpp.jam | 10 ++- 6 files changed, 183 insertions(+), 14 deletions(-) create mode 100644 tools/test/hash_collect_test.py diff --git a/libs/hash b/libs/hash index 3c9505a7..624f8161 160000 --- a/libs/hash +++ b/libs/hash @@ -1 +1 @@ -Subproject commit 3c9505a78305856a1c8664bf92f235cb3cc69c63 +Subproject commit 624f81617b05e691d7417b6033b23e629fa436d4 diff --git a/tools/test/emscripten_test.py b/tools/test/emscripten_test.py index 5e40f61b..1f3989d1 100644 --- a/tools/test/emscripten_test.py +++ b/tools/test/emscripten_test.py @@ -555,6 +555,20 @@ def test_the_size_table_lists_every_variant(root): assert len(tables) == 1 and tables[0].read_text().startswith('| program | jspi |'), tables +def test_the_size_table_is_built_from_release_builds_alone(root): + # Published sizes are those of release builds: webcpp.size-table requires release, + # so a build that asks for debug still writes its table, and the manifest and programs it + # reads, at variant=release, under b2's release directory. + result = harness.run_b2(root, '-a', *EMSCRIPTEN, 'variant=debug', + 'libs/browser_demo/test/variants//shell.sizes.md') + harness.expect(result, True, '| shell |') + tables = built(root, 'shell.sizes.md') + manifests = built(root, 'shell.variants.json') + assert len(tables) == 1 and 'release' in tables[0].parts, tables + assert manifests and all('release' in m.parts and 'debug' not in m.parts + for m in manifests), manifests + + def test_variants_are_not_built_natively(root): harness.without_emscripten(root) result = harness.run_b2(root, '-a', 'libs/browser_demo/test/variants//shell.sizes.md') @@ -714,6 +728,7 @@ def run(root): test_variants_can_be_driven_without_relinking_dependencies, test_variants_asked_for_with_javascript_exceptions_are_refused, test_the_size_table_lists_every_variant, + test_the_size_table_is_built_from_release_builds_alone, test_variants_are_not_built_natively, test_drive_runs_its_program_on_each_target, test_a_hanging_drive_is_stopped_within_its_bound, diff --git a/tools/test/hash_collect_test.py b/tools/test/hash_collect_test.py new file mode 100644 index 00000000..326437be --- /dev/null +++ b/tools/test/hash_collect_test.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +# Copyright (c) 2026 WebCpp.org +# +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +"""Checks that libs/hash/bench/collect.py, which measures bench/pbkdf2_sha512 and renders +doc/performance.adoc, builds its table only from release builds: a program whose build directory, +b2's bench///..., names another variant, or does not say, is refused before +anything runs or is written; one at variant=release is taken (it gets as far as running); and +`--render-only` refuses data whose build is not variant=release, before it writes the page. Run +with the names of some cases to run only those.""" + +from __future__ import annotations + +import json +import subprocess +import sys +import tempfile +from collections.abc import Callable +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +COLLECT = ROOT / 'libs/hash/bench/collect.py' + + +def run(*args: str | Path) -> subprocess.CompletedProcess[str]: + return subprocess.run([sys.executable, str(COLLECT), *map(str, args)], cwd=ROOT, + capture_output=True, text=True, check=False, timeout=120) + + +def program(scratch: Path, variant: str) -> Path: + """A stand-in of bench/pbkdf2_sha512 where b2 builds it at variant, which fails when run.""" + path = (scratch / 'bin/libs/hash/bench/clang-darwin-21' / variant + / 'cxxstd-20-iso/optimization-speed/pbkdf2_sha512') + path.parent.mkdir(parents=True) + path.write_text('#!/bin/sh\necho "the stand-in ran" >&2\nexit 3\n') + path.chmod(0o755) + return path + + +def expect(done: subprocess.CompletedProcess[str], status: int, *texts: str) -> None: + if done.returncode != status: + raise AssertionError(f'exit {done.returncode}, not {status}\n{done.stdout}{done.stderr}') + for text in texts: + if text not in done.stderr: + raise AssertionError(f'{text!r} is not in the error:\n{done.stderr}') + + +def test_a_program_not_built_at_variant_release_is_refused(scratch: Path) -> None: + data, page = scratch / 'data.json', scratch / 'page.adoc' + for variant in ('debug', 'profile'): + exe = program(scratch / variant, variant) + done = run('--exe', f'native={exe}', '--data', data, '--page', page) + expect(done, 1, f'native={exe} was built at variant={variant}', + 'only from release builds') + if 'the stand-in ran' in done.stderr or data.exists() or page.exists(): + raise AssertionError(f'{variant}: the program ran or a file was written') + stray = scratch / 'stray/pbkdf2_sha512' + stray.parent.mkdir() + stray.write_text('') + done = run('--exe', f'wasip2={stray}', '--data', data, '--page', page) + expect(done, 1, f'wasip2={stray}', 'bench//', 'only from release builds') + + +def test_a_program_built_at_variant_release_is_measured(scratch: Path) -> None: + exe = program(scratch, 'release') + done = run('--exe', f'native={exe}', '--data', scratch / 'data.json', '--page', + scratch / 'page.adoc') + # Past the check, collect.py runs it, and stops on its failure. + expect(done, 1, 'native: --list exit 3', 'the stand-in ran') + + +def test_render_only_refuses_data_not_built_at_variant_release(scratch: Path) -> None: + committed = json.loads((ROOT / 'libs/hash/doc/measurements.throughput.json').read_text()) + page = scratch / 'page.adoc' + for build in ('variant=debug optimization=speed', None): + data = dict(committed) + if build is None: + del data['build'] + else: + data['build'] = build + path = scratch / 'data.json' + path.write_text(json.dumps(data)) + done = run('--render-only', '--data', path, '--page', page) + expect(done, 1, 'only from release builds') + if page.exists(): + raise AssertionError(f'{build}: the page was written') + path = scratch / 'data.json' + path.write_text(json.dumps(committed)) + expect(run('--render-only', '--data', path, '--page', page), 0) + if page.read_text() != (ROOT / 'libs/hash/doc/performance.adoc').read_text(): + raise AssertionError('the committed data does not render the committed page') + + +CASES: list[Callable[[Path], None]] = [ + test_a_program_not_built_at_variant_release_is_refused, + test_a_program_built_at_variant_release_is_measured, + test_render_only_refuses_data_not_built_at_variant_release, +] + + +def main(argv: list[str]) -> int: + unknown = set(argv) - {case.__name__ for case in CASES} + if unknown: + print(f'hash_collect_test: no case named {", ".join(sorted(unknown))}', file=sys.stderr) + return 2 + for case in CASES: + if argv and case.__name__ not in argv: + continue + with tempfile.TemporaryDirectory(prefix='webcpp hash collect ') as scratch: + case(Path(scratch)) + print(f'{case.__name__}: ok') + print('hash_collect_test: ok') + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/variants/variants.py b/tools/variants/variants.py index fbd286c2..cfcbe015 100755 --- a/tools/variants/variants.py +++ b/tools/variants/variants.py @@ -8,7 +8,7 @@ """Writes the manifest of a page program's suspension variants, and the table of their sizes. Usage: variants.py manifest --out FILE --jspi SCRIPT --asyncify SCRIPT - variants.py table --out FILE MANIFEST... + variants.py table --variant VARIANT --out FILE MANIFEST... manifest writes FILE, .variants.json, which a page's loader reads: for each variant, the script, its JavaScript glue, relative to FILE's directory and written with /, and the size in bytes @@ -17,7 +17,10 @@ table writes FILE, a Markdown table of every manifest's sizes, one row per program named by its manifest's file name less .variants.json, sorted, with asyncify's size over jspi's, and prints it. -A manifest that lacks a variant, its script or a positive integer size is refused, naming it. +A manifest that lacks a variant, its script or a positive integer size is refused, naming it. A +table is built only from release builds: VARIANT, the b2 variant the manifests were built at +(webcpp.size-table, which requires release, gives it), other than release is refused +before anything is written. A failure is a line on the standard error and status 1; a usage error is status 2. """ @@ -33,6 +36,8 @@ VARIANTS = ('jspi', 'asyncify') SUFFIX = '.variants.json' +# The only b2 variant a size table is built from. +RELEASE = 'release' class Refused(Exception): @@ -83,9 +88,12 @@ def program(path: Path) -> str: return name[:-len(SUFFIX)] if name.endswith(SUFFIX) else name -def table(out: Path, manifests: list[Path]) -> str: - """Writes out, the Markdown table of the manifests' sizes, and returns it; refuses a manifest - that is not one before it writes anything.""" +def table(out: Path, manifests: list[Path], variant: str) -> str: + """Writes out, the Markdown table of the manifests' sizes, and returns it; refuses a build at + another variant than release, and a manifest that is not one, before it writes anything.""" + if variant != RELEASE: + raise Refused(f'a size table is built only from release builds, not variant={variant}: ' + 'webcpp.size-table requires release') rows = sorted((program(path), *sizes(path)) for path in manifests) lines = ['| program | jspi | asyncify | asyncify / jspi |', '| --- | ---: | ---: | ---: |'] lines += [f'| {name} | {jspi:,} | {asyncify:,} | {asyncify / jspi:.2f} |' @@ -105,6 +113,8 @@ def parser() -> argparse.ArgumentParser: for variant in VARIANTS: written.add_argument(f'--{variant}', type=Path, required=True) sized = commands.add_parser('table', help='write the table of the manifests\' sizes') + sized.add_argument('--variant', required=True, + help='the b2 variant the manifests were built at: only release is taken') sized.add_argument('--out', type=Path, required=True) sized.add_argument('manifests', type=Path, nargs='+') return parsed @@ -118,7 +128,7 @@ def main(argv: list[str]) -> int: manifest(arguments.out, {variant: getattr(arguments, variant) for variant in VARIANTS}) else: - sys.stdout.write(table(arguments.out, arguments.manifests)) + sys.stdout.write(table(arguments.out, arguments.manifests, arguments.variant)) except Refused as refused: print(f'variants.py: {refused}', file=sys.stderr) return 1 diff --git a/tools/variants/variants_test.py b/tools/variants/variants_test.py index 907b5ab6..525228a1 100755 --- a/tools/variants/variants_test.py +++ b/tools/variants/variants_test.py @@ -8,8 +8,9 @@ """Checks tools/variants/variants.py: a manifest names each variant's script relative to itself and the size of its .wasm, in sorted keys and four spaces; an artifact without its script or its .wasm is refused before anything is written; a table lists each program with its sizes and their ratio, -in the file and on the standard output; and a manifest that is not one is refused, naming it. Run -with the names of some cases to run only those.""" +in the file and on the standard output; a manifest that is not one is refused, naming it; and a +table is written only from release builds: given another variant, or none, it is refused before +anything is written. Run with the names of some cases to run only those.""" from __future__ import annotations @@ -76,7 +77,7 @@ def test_table_lists_each_program_with_its_ratio(root: Path) -> None: manifest = root / 'page.variants.json' variants('manifest', '--out', manifest, '--jspi', jspi, '--asyncify', asyncify) out = root / 'sizes.md' - result = variants('table', '--out', out, manifest) + result = variants('table', '--variant', 'release', '--out', out, manifest) assert result.returncode == 0, result.stderr table = ('| program | jspi | asyncify | asyncify / jspi |\n' '| --- | ---: | ---: | ---: |\n' @@ -87,16 +88,35 @@ def test_table_lists_each_program_with_its_ratio(root: Path) -> None: def test_table_refuses_a_manifest_that_is_not_one(root: Path) -> None: bad = root / 'bad.variants.json' bad.write_text('{"jspi": {}}\n') - result = variants('table', '--out', root / 'sizes.md', bad) + result = variants('table', '--variant', 'release', '--out', root / 'sizes.md', bad) assert result.returncode == 1 and f'{bad}: ' in result.stderr, result.stderr +def test_table_refuses_a_build_that_is_not_release(root: Path) -> None: + # Published sizes are those of release builds: webcpp.size-table requires release + # and gives the table's variant, which variants.py refuses to be any other. + jspi, asyncify = scripts(root) + manifest = root / 'page.variants.json' + variants('manifest', '--out', manifest, '--jspi', jspi, '--asyncify', asyncify) + out = root / 'sizes.md' + for variant in ('debug', 'profile'): + result = variants('table', '--variant', variant, '--out', out, manifest) + assert result.returncode == 1, (variant, result.returncode, result.stderr) + assert (f'variants.py: a size table is built only from release builds, not ' + f'variant={variant}') in result.stderr, result.stderr + assert not out.exists(), variant + result = variants('table', '--out', out, manifest) + assert result.returncode == 2 and '--variant' in result.stderr, result.stderr + assert not out.exists() + + CASES: list[Callable[[Path], None]] = [ test_manifest_names_each_artifact_from_its_own_directory, test_manifest_refuses_an_artifact_without_its_wasm, test_manifest_refuses_an_artifact_without_its_script, test_table_lists_each_program_with_its_ratio, test_table_refuses_a_manifest_that_is_not_one, + test_table_refuses_a_build_that_is_not_release, ] diff --git a/tools/webcpp.jam b/tools/webcpp.jam index 0448b015..8f6c8f65 100644 --- a/tools/webcpp.jam +++ b/tools/webcpp.jam @@ -599,11 +599,14 @@ actions write-variants # The sizes of the variants of each program webcpp.variants declared in this # Jamfile under the names variants: the explicit .sizes.md, a Markdown # table the build also prints, and which the CI keeps from an own lane's job -# (.github/workflows/library.yml, the artifact sizes-). +# (.github/workflows/library.yml, the artifact sizes-). Published sizes +# are those of release builds alone: the table requires release, +# which its manifests and their programs inherit, whatever variant the +# command asks for, and variants.py refuses a table of any other variant. rule size-table ( name : variants + ) { make $(name).sizes.md : $(variants).variants.json : @webcpp%write-size-table - : emscripten @webcpp%filter ; + : release emscripten @webcpp%filter ; local found = [ where ] ; $(found[1]).mark-target-as-explicit $(name).sizes.md ; } @@ -623,11 +626,12 @@ rule write-size-table ( targets * : sources * : properties * ) } } MANIFESTS on $(targets) = $(manifests) ; + VARIANT on $(targets) = [ feature.get-values : $(properties) ] ; } actions write-size-table bind MANIFESTS { - "$(PYTHON)" "$(SCRIPT)" table --out "$(<)" "$(MANIFESTS)" + "$(PYTHON)" "$(SCRIPT)" table --variant "$(VARIANT)" --out "$(<)" "$(MANIFESTS)" } # A test that passes when sources compile, which builds no program. From 5d2bd7724151f793c419c0c0f65d379e4932d00b Mon Sep 17 00:00:00 2001 From: R Date: Mon, 16 Nov 2026 15:39:18 -0300 Subject: [PATCH 2/3] tools: one platform-independent wasi-sysroot on every host, and OpenSSL built with one fixed prefix wasi-sdk's per-host archives carry a sysroot and compiler-rt builtins of their own build, whose libc++abi keeps __FILE__ strings with the paths of the machine that built it, so a WASI program differed between macOS and Linux. tools/ci/actions/wasi-sdk/install.sh keeps the runner's clang and tools and replaces the sysroot and the builtins with the release's platform-independent wasi-sysroot-34.0 and libclang_rt-34.0, each pinned by its SHA-256, and fails on a target those lack builtins for. Outside a runner it installs this machine's build, which the README now gives as the local install. OpenSSL kept its temporary build directory as libcrypto's modules and engines directories, a residue of 80 bytes that differed by host and by run. tools/openssl/build.py configures every non-Windows build with the fixed prefix /webcpp-openssl and stages install_dev under DESTDIR. The wasi-sdk recipe changes, so the Linux-X64 prepared bundle must be prepared again before the WASI lanes of the CI can restore it. --- AGENTS.md | 23 +++- README.md | 17 ++- doc/releases/0.1.0.adoc | 3 + tools/ci/actions/wasi-sdk/action.yml | 6 +- tools/ci/actions/wasi-sdk/install.sh | 102 ++++++++++++++++-- tools/ci/actions_test.py | 153 ++++++++++++++++++++++++++- tools/openssl/build.py | 15 ++- tools/openssl/build_test.py | 32 +++++- 8 files changed, 323 insertions(+), 28 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f21e2f51..aa823ff3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -237,7 +237,9 @@ Jamroot is its build configuration, and `libs/` is its repository. configures, once per compiler and run of b2, and a GCC 15.2 stops the build before it compiles anything, naming PR121643 and asking for GCC 15.3 or newer; - Python 3.9 or newer; -- for WebAssembly: wasi-sdk 34 and wasmtime 50.0.1; +- for WebAssembly: wasi-sdk 34, with the release's platform-independent + sysroot and builtins (`bash tools/ci/actions/wasi-sdk/install.sh` installs + it so in `.local/wasi-sdk`), and wasmtime 50.0.1; - for WebAssembly components, such as wasi's: wit-bindgen 0.62.0, which generates a world's C bindings, and the `wasi:http` WIT of WASI 0.2.12 and 0.3.0, the `wit/deps` directories of the Rust crates `wasip2` 1.0.4 and @@ -1777,7 +1779,15 @@ wrapper each quoted as one word of Jam. action before it is cached. It refuses an empty or relative prefix: b2 given an empty `--prefix` installs into `/usr/local`. `install.sh source ` fills such a tree alone, for a machine whose Boost comes from elsewhere. -- `wasi-sdk` installs wasi-sdk 34 into `.local/wasi-sdk`, `wasmtime` +- `wasi-sdk` installs wasi-sdk 34 into `.local/wasi-sdk`: the runner's + build of its clang and tools, with the release's platform-independent + `wasi-sysroot-34.0` and `libclang_rt-34.0` in place of that build's + sysroot and compiler-rt builtins, each archive pinned by its SHA-256. A + per-host build's own sysroot carries `__FILE__` strings with the paths of + the machine that built it, so a WASI program would differ by host; with + the shared sysroot it is the same bytes on every host. Its `install.sh` + also installs wasi-sdk locally, from the superproject's root, for the + machine's own system and processor. `wasmtime` installs wasmtime 50.0.1 on `PATH`, `mrdocs` installs MrDocs 2026.9.29 into `.local/mrdocs`, and `node` sets up Node 26.7.0, with npm's cache keyed on the lock files of `tools/doc`, `tools/lint`, every library's @@ -1933,7 +1943,9 @@ The full lane set, `b2 -a`, fresh XML and missing-result checks remain mandatory action defines a function of its own that `helpers.sh` holds), the Boost action's prefix checks and the layouts it installs the headers and b2 in, and where the wit-bindgen, WASI WIT and emsdk actions install what they download, what -they leave out, and their refusals: a runner no build of wit-bindgen or +they leave out, and their refusals; that the wasi-sdk action replaces the +runner's sysroot and builtins with the platform-independent ones, and fails +on a target those lack builtins for: a runner no build of wit-bindgen or emsdk is pinned for, a crate that holds no WIT, an emsdk at another commit, a release without its `node_modules`, an archive emsdk would download unpinned, and an emcc that is not 6.0.11; the emsdk action's node wrapper, @@ -1947,7 +1959,10 @@ corruption, interrupted transfers and atomic output. Their refusal tests cover b and unsupported runners. Source-provider tests live in `tools/openssl/build_test.py`, `tools/test/openssl_test.py` and `tools/test/libdatachannel_test.py`: they cover source pins, staged content, -compiler variants and the single OpenSSL provider. They are separate from +compiler variants, the single OpenSSL provider, and OpenSSL's one fixed +prefix, `/webcpp-openssl`, which libcrypto keeps as its modules and engines +directories and `install_dev` stages under `DESTDIR`, so that the library is +the same bytes wherever it is built. They are separate from runtime evidence and the full upstream OpenSSL suite. **The site.** On every run of the superproject's CI, the job `site` runs diff --git a/README.md b/README.md index 215a507a..01c9ab3b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,8 @@ library on every target are published at . - Python 3.9 or newer, which compares the examples with their expected output and runs the tests of the build itself; - for WebAssembly, wasi-sdk 34, whose clang builds for wasm32-wasip2 and - wasm32-wasip3, and wasmtime 50.0.1, which runs what it builds; + wasm32-wasip3, with the release's platform-independent sysroot (below), + and wasmtime 50.0.1, which runs what it builds; - for emscripten, Emscripten 6.0.11 from emsdk, and Node, which runs what it builds; - for trystero's native backend, CMake, which builds libdatachannel 0.24.6 and @@ -145,8 +146,18 @@ with `python3 tools/openssl/update.py` after changing the source commit. ### WebAssembly Each library declares the targets it is built for. To build them for -wasm32-wasip2 and wasm32-wasip3, register two clang toolsets against -wasi-sdk 34 in `~/user-config.jam`: +wasm32-wasip2 and wasm32-wasip3, install wasi-sdk 34 in `.local/wasi-sdk` +from the superproject's root, as the CI does: + + bash tools/ci/actions/wasi-sdk/install.sh + +It installs the build of wasi-sdk for your system and processor, with the +release's platform-independent sysroot and compiler-rt builtins in place of +that build's own, each archive checked against its SHA-256. A per-host +archive's sysroot carries the paths of the machine that built it in its +libraries, so the same WASI program would differ from one host to another; +with the shared sysroot it is the same bytes on every host. Then register +two clang toolsets against it in `~/user-config.jam`: local wasi-sdk = /path/to/wasi-sdk ; modules.poke : WASI_SDK : $(wasi-sdk) ; diff --git a/doc/releases/0.1.0.adoc b/doc/releases/0.1.0.adoc index 3a833afb..c0792ab1 100644 --- a/doc/releases/0.1.0.adoc +++ b/doc/releases/0.1.0.adoc @@ -95,6 +95,9 @@ None. * Fixed a stacked table's caption shrinking to its longest word. * Added the user's Jamfiles of webcpp::hash, tested as fixtures of a test of the tools. * Changed the lint's canary-pins rule to read webcpp::hash's detail/canary.h beside webcpp::crypto's. +* Changed wasi-sdk's install to use the release's platform-independent sysroot and builtins, so a WASI program is the same bytes on every host. +* Fixed OpenSSL's libcrypto keeping the temporary directory it was built in; one fixed prefix makes it the same bytes on every build. +* Changed webcpp.size-table's tables and webcpp::hash's PBKDF2 throughput table (bench/collect.py) to be built only from release builds. * Fixed the WASIp2 test launcher interrupting large finite workloads after 60 seconds. * Fixed Chrome provisioning and browser/TLS profile coverage in Asio CI lanes. * Added source-built OpenSSL and Cobalt SSL targets for WASIp2. diff --git a/tools/ci/actions/wasi-sdk/action.yml b/tools/ci/actions/wasi-sdk/action.yml index c9f20802..27dc2392 100644 --- a/tools/ci/actions/wasi-sdk/action.yml +++ b/tools/ci/actions/wasi-sdk/action.yml @@ -6,8 +6,10 @@ name: wasi-sdk description: >- - Installs wasi-sdk 34.0 in .local/wasi-sdk, checked against its SHA-256: the compiler of the - wasip2 and wasip3 lanes, and the clang-format and clang-tidy of the lint. + Installs wasi-sdk 34.0 in .local/wasi-sdk, the runner's build with the release's + platform-independent sysroot and compiler-rt builtins, each archive checked against its + SHA-256: the compiler of the wasip2 and wasip3 lanes, whose programs are then the same bytes on + every host, and the clang-format and clang-tidy of the lint. runs: using: composite diff --git a/tools/ci/actions/wasi-sdk/install.sh b/tools/ci/actions/wasi-sdk/install.sh index bc13937a..f9783544 100755 --- a/tools/ci/actions/wasi-sdk/install.sh +++ b/tools/ci/actions/wasi-sdk/install.sh @@ -5,43 +5,123 @@ # accompanying file LICENSE_1_0.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) -# The step of tools/ci/actions/wasi-sdk: wasi-sdk 34.0 in .local/wasi-sdk, where the README -# installs it, for the runner's system and processor (RUNNER_OS, RUNNER_ARCH). Its clang++ -# builds the wasip2 and wasip3 lanes, which tools/ci/matrix.py registers, and its clang-format -# and clang-tidy are the lint's. +# The step of tools/ci/actions/wasi-sdk, and the install of wasi-sdk on a developer's machine: +# wasi-sdk 34.0 in .local/wasi-sdk, where the README installs it, its clang and tools those of the +# runner's system and processor (RUNNER_OS, RUNNER_ARCH), and its sysroot and its compiler-rt +# builtins the release's platform-independent ones, wasi-sysroot-34.0 and libclang_rt-34.0, on +# every host. Its clang++ builds the wasip2 and wasip3 lanes, which tools/ci/matrix.py registers, +# and its clang-format and clang-tidy are the lint's. +# +# Each per-host archive of wasi-sdk carries a sysroot and builtins of its own build, made on the +# machine that built that archive: wasi-sdk's libc++abi keeps __FILE__ strings with that +# machine's paths (/Users/runner/work/wasi-sdk/... in the macOS archive, /src/... in the Linux +# one), which become bytes of every program that links them. Replacing both with the release's +# platform-independent archives makes a WASI program the same bytes whichever host builds it, +# as webcpp::hash's measured table needs (libs/hash/test/measure). # # Usage, from the superproject's root: install.sh +# Outside a runner, RUNNER_OS and RUNNER_ARCH default to this machine's, and RUNNER_TEMP to a +# temporary directory of its own. set -euo pipefail +if [ -z "${RUNNER_OS-}" ]; then + case "$(uname -s)" in + Darwin) RUNNER_OS=macOS ;; + Linux) RUNNER_OS=Linux ;; + *) RUNNER_OS="$(uname -s)" ;; + esac +fi +if [ -z "${RUNNER_ARCH-}" ]; then + case "$(uname -m)" in + arm64|aarch64) RUNNER_ARCH=ARM64 ;; + x86_64|amd64) RUNNER_ARCH=X64 ;; + *) RUNNER_ARCH="$(uname -m)" ;; + esac +fi + +version=34.0 base=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34 case "${RUNNER_OS}-${RUNNER_ARCH}" in Linux-X64) - asset=wasi-sdk-34.0-x86_64-linux.tar.gz + asset=wasi-sdk-${version}-x86_64-linux.tar.gz sha256=b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4 ;; Linux-ARM64) - asset=wasi-sdk-34.0-arm64-linux.tar.gz + asset=wasi-sdk-${version}-arm64-linux.tar.gz sha256=f7e243dff54d60bcc576e94d6166b69f410f2500ae4a9ceef34315be10e77971 ;; macOS-ARM64) - asset=wasi-sdk-34.0-arm64-macos.tar.gz + asset=wasi-sdk-${version}-arm64-macos.tar.gz sha256=9c59398106b417f8f14913380fdf0097a8cc0ff4af9eb3ce0065a859e88d49e9 ;; macOS-X64) - asset=wasi-sdk-34.0-x86_64-macos.tar.gz + asset=wasi-sdk-${version}-x86_64-macos.tar.gz sha256=87d27fa8adc68dee59bfbf2e22a6d34ef717c34d6bf1d8af2a56fc929d9ce0eb ;; *) - printf 'install.sh: no wasi-sdk 34.0 is pinned for %s on %s\n' "${RUNNER_OS}" \ - "${RUNNER_ARCH}" >&2 + printf 'install.sh: no wasi-sdk %s is pinned for %s on %s\n' "${version}" \ + "${RUNNER_OS}" "${RUNNER_ARCH}" >&2 exit 1 ;; esac +# The release's platform-independent sysroot and compiler-rt builtins, the same on every host. +sysroot=wasi-sysroot-${version}.tar.gz +sysroot_sha256=9d813544eeebe38b7b8f2244ed591de46b6db812c6dd1a257ff9f0d2a905a2be +builtins=libclang_rt-${version}.tar.gz +builtins_sha256=eee3e634dcf71aa22b1333391623cf5c9965a637dc428a27b1a858c026c587f1 + +temporary= +if [ -z "${RUNNER_TEMP-}" ]; then + temporary="$(mktemp -d)" + RUNNER_TEMP="${temporary}" +fi +staging= +cleanup() { + rm -f -- "${RUNNER_TEMP}/${asset}" "${RUNNER_TEMP}/${sysroot}" "${RUNNER_TEMP}/${builtins}" + [ -z "${staging}" ] || rm -rf -- "${staging}" + [ -z "${temporary}" ] || rm -rf -- "${temporary}" +} +trap cleanup EXIT here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" "${here}/../../download.sh" "${base}/${asset}" "${sha256}" "${RUNNER_TEMP}/${asset}" +"${here}/../../download.sh" "${base}/${sysroot}" "${sysroot_sha256}" "${RUNNER_TEMP}/${sysroot}" +"${here}/../../download.sh" "${base}/${builtins}" "${builtins_sha256}" \ + "${RUNNER_TEMP}/${builtins}" + rm -rf .local/wasi-sdk mkdir -p .local/wasi-sdk tar -xzf "${RUNNER_TEMP}/${asset}" -C .local/wasi-sdk --strip-components=1 -rm "${RUNNER_TEMP}/${asset}" +staging="$(mktemp -d "${RUNNER_TEMP}/wasi-sdk-shared.XXXXXX")" +mkdir "${staging}/sysroot" "${staging}/builtins" +tar -xzf "${RUNNER_TEMP}/${sysroot}" -C "${staging}/sysroot" --strip-components=1 +tar -xzf "${RUNNER_TEMP}/${builtins}" -C "${staging}/builtins" --strip-components=1 + +# The sysroot where clang looks for it, /share/wasi-sysroot, in place of the archive's. +rm -rf .local/wasi-sdk/share/wasi-sysroot +mv "${staging}/sysroot" .local/wasi-sdk/share/wasi-sysroot + +# The builtins of each WebAssembly target, in clang's resource directory, in place of the +# archive's: every target the archive has must be one the platform-independent archive has, so +# that no program links a per-host build of them. +resources=(.local/wasi-sdk/lib/clang/*/lib) +if [ "${#resources[@]}" -ne 1 ] || [ ! -d "${resources[0]}" ]; then + printf 'install.sh: wasi-sdk %s has not one lib/clang//lib\n' "${version}" >&2 + exit 1 +fi +for target in "${resources[0]}"/wasm32-*; do + name="$(basename "${target}")" + if [ ! -f "${staging}/builtins/${name}/libclang_rt.builtins.a" ]; then + printf 'install.sh: %s has no builtins for %s\n' "${builtins}" "${name}" >&2 + exit 1 + fi +done +for target in "${staging}/builtins"/wasm32-*; do + name="$(basename "${target}")" + rm -rf "${resources[0]:?}/${name}" + mv "${target}" "${resources[0]}/${name}" +done + .local/wasi-sdk/bin/clang++ --version +printf 'install.sh: the sysroot and builtins of wasi-sdk %s are the platform-independent %s and %s\n' \ + "${version}" "${sysroot}" "${builtins}" diff --git a/tools/ci/actions_test.py b/tools/ci/actions_test.py index abe6b0a0..55434d57 100755 --- a/tools/ci/actions_test.py +++ b/tools/ci/actions_test.py @@ -20,7 +20,12 @@ when it fails. The wit-bindgen action installs the build of the runner's system and processor, the program alone, in .local/wit-bindgen, where the build looks for it, in place of what was there, and refuses a runner it pins no build -for before it downloads anything; the wasmtime action installs the pinned build for each runner +for before it downloads anything; the wasi-sdk action installs the runner's build of wasi-sdk 34.0 +in .local/wasi-sdk, in place of what was there, with the release's platform-independent sysroot and +compiler-rt builtins in place of the build's own, the same archives on every runner (outside a +runner, this machine's build), fails, naming the target, when the build has builtins for a target +the platform-independent archive has none for, and refuses a runner it pins no build for before it +downloads anything; the wasmtime action installs the pinned build for each runner in RUNNER_TEMP/wasmtime, replaces an earlier install, exports its directory through GITHUB_PATH, and refuses an unsupported runner before downloading; the wasi-wit action installs the wit/deps directory of each crate, wasip2's and wasip3's, in .local/wasi-wit/p2 and .local/wasi-wit/p3, @@ -49,6 +54,7 @@ import hashlib import io import os +import platform import re import shutil import socket @@ -67,6 +73,7 @@ WIT_BINDGEN = CI / 'actions/wit-bindgen/install.sh' WASMTIME = CI / 'actions/wasmtime/install.sh' WASI_WIT = CI / 'actions/wasi-wit/install.sh' +WASI_SDK = CI / 'actions/wasi-sdk/install.sh' EMSDK = CI / 'actions/emsdk/install.sh' HELPERS = CI / 'helpers.sh' @@ -566,6 +573,146 @@ def test_wit_bindgen_refuses_a_runner_it_pins_no_build_for(scratch: Path) -> Non assert not (scratch / '.local').exists() +WASI_SDK_RELEASE = 'https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34' + +# The runners the action pins a build of wasi-sdk 34.0 for, the build's name and its digest. +WASI_SDK_BUILDS = { + ('Linux', 'X64'): ( + 'x86_64-linux', 'b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4'), + ('Linux', 'ARM64'): ( + 'arm64-linux', 'f7e243dff54d60bcc576e94d6166b69f410f2500ae4a9ceef34315be10e77971'), + ('macOS', 'ARM64'): ( + 'arm64-macos', '9c59398106b417f8f14913380fdf0097a8cc0ff4af9eb3ce0065a859e88d49e9'), + ('macOS', 'X64'): ( + 'x86_64-macos', '87d27fa8adc68dee59bfbf2e22a6d34ef717c34d6bf1d8af2a56fc929d9ce0eb'), +} +# The release's platform-independent archives, the same on every runner. +WASI_SYSROOT = (f'{WASI_SDK_RELEASE}/wasi-sysroot-34.0.tar.gz', + '9d813544eeebe38b7b8f2244ed591de46b6db812c6dd1a257ff9f0d2a905a2be') +WASI_BUILTINS = (f'{WASI_SDK_RELEASE}/libclang_rt-34.0.tar.gz', + 'eee3e634dcf71aa22b1333391623cf5c9965a637dc428a27b1a858c026c587f1') +WASI_TARGETS = ('wasm32-unknown-wasip2', 'wasm32-unknown-wasip3') + + +def wasi_sdk_archives(scratch: Path, build: str, sdk_targets: tuple[str, ...] = WASI_TARGETS, + shared_targets: tuple[str, ...] = WASI_TARGETS) -> dict[str, Path]: + """Stand-ins of the three archives the action downloads, by URL: the build's wasi-sdk, whose + sysroot and builtins (of sdk_targets) say they are the build's, and the release's + platform-independent sysroot and builtins (of shared_targets).""" + sdk = scratch / 'archive' / build + (sdk / 'bin').mkdir(parents=True) + clang = sdk / 'bin/clang++' + clang.write_text(f'#!/bin/sh\necho "clang version 23.1.0-wasi-sdk (stand-in {build})"\n') + clang.chmod(0o755) + (sdk / 'share/wasi-sysroot/lib/wasm32-wasip2').mkdir(parents=True) + (sdk / 'share/wasi-sysroot/lib/wasm32-wasip2/libc++abi.a').write_text(f'{build}\n') + (sdk / 'lib/clang/23/include').mkdir(parents=True) + (sdk / 'lib/clang/23/include/stdint.h').write_text('header\n') + for target in sdk_targets: + (sdk / 'lib/clang/23/lib' / target).mkdir(parents=True) + (sdk / 'lib/clang/23/lib' / target / 'libclang_rt.builtins.a').write_text(f'{build}\n') + sysroot = scratch / 'archive/sysroot' + (sysroot / 'lib/wasm32-wasip2').mkdir(parents=True) + (sysroot / 'VERSION').write_text('34.0\n') + (sysroot / 'lib/wasm32-wasip2/libc++abi.a').write_text('platform-independent\n') + builtins = scratch / 'archive/builtins' + for target in shared_targets: + (builtins / target).mkdir(parents=True) + (builtins / target / 'libclang_rt.builtins.a').write_text('platform-independent\n') + return { + f'{WASI_SDK_RELEASE}/wasi-sdk-34.0-{build}.tar.gz': + tar_gz(scratch / f'wasi-sdk-34.0-{build}.tar.gz', sdk, f'wasi-sdk-34.0-{build}'), + WASI_SYSROOT[0]: tar_gz(scratch / 'wasi-sysroot-34.0.tar.gz', sysroot, + 'wasi-sysroot-34.0'), + WASI_BUILTINS[0]: tar_gz(scratch / 'libclang_rt-34.0.tar.gz', builtins, + 'libclang_rt-34.0'), + } + + +def tree_of(directory: Path) -> dict[str, str]: + """Every file under directory, by its path relative to it, and its text.""" + return {path.relative_to(directory).as_posix(): path.read_text() + for path in sorted(directory.rglob('*')) if path.is_file()} + + +def test_wasi_sdk_installs_the_platform_independent_sysroot_and_builtins(scratch: Path) -> None: + for (system, processor), (build, digest) in WASI_SDK_BUILDS.items(): + root = scratch / build + root.mkdir() + script = serving_tree(root, 'wasi-sdk', WASI_SDK, wasi_sdk_archives(root, build)) + stale = root / '.local/wasi-sdk/stale' + stale.parent.mkdir(parents=True) + stale.write_text('stale\n') + runner = {'RUNNER_OS': system, 'RUNNER_ARCH': processor, + 'RUNNER_TEMP': str(root / 'temp')} + result = subprocess.run(['bash', str(script)], capture_output=True, text=True, + check=False, cwd=root, env={**os.environ, **runner}) + assert result.returncode == 0, (build, result.returncode, result.stderr) + installed = root / '.local/wasi-sdk' + assert f'stand-in {build}' in result.stdout, (build, result.stdout) + assert tree_of(installed) == { + 'bin/clang++': f'#!/bin/sh\necho "clang version 23.1.0-wasi-sdk (stand-in {build})"\n', + 'lib/clang/23/include/stdint.h': 'header\n', + 'lib/clang/23/lib/wasm32-unknown-wasip2/libclang_rt.builtins.a': + 'platform-independent\n', + 'lib/clang/23/lib/wasm32-unknown-wasip3/libclang_rt.builtins.a': + 'platform-independent\n', + 'share/wasi-sysroot/VERSION': '34.0\n', + 'share/wasi-sysroot/lib/wasm32-wasip2/libc++abi.a': 'platform-independent\n', + }, (build, tree_of(installed)) + assert downloads(root) == [(f'{WASI_SDK_RELEASE}/wasi-sdk-34.0-{build}.tar.gz', digest), + WASI_SYSROOT, WASI_BUILTINS], (build, downloads(root)) + assert list((root / 'temp').iterdir()) == [], (build, list((root / 'temp').iterdir())) + + +def test_wasi_sdk_outside_a_runner_installs_this_machine_s_build(scratch: Path) -> None: + system = {'Darwin': 'macOS', 'Linux': 'Linux'}.get(platform.system(), '') + processor = {'arm64': 'ARM64', 'aarch64': 'ARM64', 'x86_64': 'X64', + 'AMD64': 'X64'}.get(platform.machine(), '') + if (system, processor) not in WASI_SDK_BUILDS: + print('test_wasi_sdk_outside_a_runner_installs_this_machine_s_build: no wasi-sdk is ' + f'pinned for {platform.system()} on {platform.machine()}; skipped') + return + build, digest = WASI_SDK_BUILDS[(system, processor)] + script = serving_tree(scratch, 'wasi-sdk', WASI_SDK, wasi_sdk_archives(scratch, build)) + environ = {k: v for k, v in os.environ.items() + if k not in ('RUNNER_OS', 'RUNNER_ARCH', 'RUNNER_TEMP')} + result = subprocess.run(['bash', str(script)], capture_output=True, text=True, check=False, + cwd=scratch, env=environ) + assert result.returncode == 0, (result.returncode, result.stderr) + assert f'stand-in {build}' in result.stdout, result.stdout + assert downloads(scratch)[0] == (f'{WASI_SDK_RELEASE}/wasi-sdk-34.0-{build}.tar.gz', digest) + assert (scratch / '.local/wasi-sdk/share/wasi-sysroot/VERSION').is_file() + + +def test_wasi_sdk_fails_on_a_target_without_platform_independent_builtins( + scratch: Path) -> None: + archives = wasi_sdk_archives(scratch, 'x86_64-linux', + sdk_targets=WASI_TARGETS + ('wasm32-unknown-wasip1',)) + script = serving_tree(scratch, 'wasi-sdk', WASI_SDK, archives) + runner = {'RUNNER_OS': 'Linux', 'RUNNER_ARCH': 'X64', 'RUNNER_TEMP': str(scratch / 'temp')} + result = subprocess.run(['bash', str(script)], capture_output=True, text=True, check=False, + cwd=scratch, env={**os.environ, **runner}) + assert result.returncode == 1, (result.returncode, result.stderr) + assert ('install.sh: libclang_rt-34.0.tar.gz has no builtins for wasm32-unknown-wasip1' + in result.stderr), result.stderr + assert list((scratch / 'temp').iterdir()) == [] + + +def test_wasi_sdk_refuses_a_runner_it_pins_no_build_for(scratch: Path) -> None: + script = serving_tree(scratch, 'wasi-sdk', WASI_SDK, {}) + for system, processor in (('Windows', 'X64'), ('Linux', 'ARM')): + runner = {'RUNNER_OS': system, 'RUNNER_ARCH': processor, + 'RUNNER_TEMP': str(scratch / 'temp')} + result = subprocess.run(['bash', str(script)], capture_output=True, text=True, + check=False, cwd=scratch, env={**os.environ, **runner}) + assert result.returncode == 1, (system, processor, result.returncode, result.stderr) + assert (f'install.sh: no wasi-sdk 34.0 is pinned for {system} on {processor}' + in result.stderr), result.stderr + assert downloads(scratch) == [] + assert not (scratch / '.local').exists() + + WASMTIME_RELEASE = 'https://github.com/bytecodealliance/wasmtime/releases/download/v50.0.1' # Official release asset digests, also verified against the four downloaded archives. @@ -1354,6 +1501,10 @@ def helper(call: str, **variables: str) -> str: test_boost_source_that_fails_leaves_the_tree_and_no_files, test_wit_bindgen_installs_the_runners_build_alone, test_wit_bindgen_refuses_a_runner_it_pins_no_build_for, + test_wasi_sdk_installs_the_platform_independent_sysroot_and_builtins, + test_wasi_sdk_outside_a_runner_installs_this_machine_s_build, + test_wasi_sdk_fails_on_a_target_without_platform_independent_builtins, + test_wasi_sdk_refuses_a_runner_it_pins_no_build_for, test_wasmtime_installs_the_pinned_runners_build, test_wasmtime_refuses_a_runner_it_pins_no_build_for, test_wasi_wit_installs_each_crates_wit_deps, diff --git a/tools/openssl/build.py b/tools/openssl/build.py index 19ede301..638d9d52 100644 --- a/tools/openssl/build.py +++ b/tools/openssl/build.py @@ -29,6 +29,12 @@ from source import check_checkout, stage_source HERE = Path(__file__).resolve().parent +# The prefix OpenSSL is configured with outside Windows, which libcrypto keeps as its MODULESDIR +# and ENGINESDIR: one fixed path where nothing is ever installed, so that the library, and every +# program that links it, is the same bytes wherever and whenever it is built. A prefix in the +# build's temporary directory made a WASI program differ from one host, and one run, to another. +# install_dev stages it under DESTDIR in that directory. +PREFIX = '/webcpp-openssl' def run(command: list[str], *, cwd: Path, env: dict[str, str], log: Path, @@ -252,7 +258,9 @@ def build_source(args: argparse.Namespace, output: Path, pin: dict, scratch: Pat started = time.monotonic() build = scratch / 'build' build.mkdir() - install = scratch / 'install' + # Windows stages its headers and archives itself (below), without install_dev. + install = scratch / 'install' if windows else scratch / 'stage' / PREFIX.lstrip('/') + prefix = str(install) if windows else PREFIX actual_target = target if args.platform == 'wasi': # Copying also works when symlink creation needs Windows privileges. @@ -263,7 +271,7 @@ def build_source(args: argparse.Namespace, output: Path, pin: dict, scratch: Pat actual_target = ['--config=' + str(scratch / 'msvc.conf'), target[-1]] perl = windows_perl(env) if windows else 'perl' run([perl, str(scratch / 'source/Configure'), *actual_target, *options, - '--prefix=' + str(install)], cwd=build, env=env, log=output / 'configure.log') + '--prefix=' + prefix], cwd=build, env=env, log=output / 'configure.log') make = ['nmake', '/nologo'] if windows else ['make'] jobs = [] if windows else ['-j2'] if args.headers_only: @@ -305,7 +313,8 @@ def build_source(args: argparse.Namespace, output: Path, pin: dict, scratch: Pat if symbols.is_file(): shutil.copyfile(symbols, output / symbols.name) else: - run([*make, 'install_dev'], cwd=build, env=env, log=output / 'install.log') + run([*make, 'DESTDIR=' + str(scratch / 'stage'), 'install_dev'], cwd=build, env=env, + log=output / 'install.log') # Headers were already prepared with this configuration. Keep identical # files untouched: consumers can be compiling with them during this action. # Publish any changed headers atomically before making archives available. diff --git a/tools/openssl/build_test.py b/tools/openssl/build_test.py index a80d758d..37bf307e 100644 --- a/tools/openssl/build_test.py +++ b/tools/openssl/build_test.py @@ -41,20 +41,29 @@ def setUp(self) -> None: (self.generated / 'include/openssl/configuration.h').write_bytes(self.original) self.header.write_bytes(self.original) - def publish(self, full: bool) -> None: + def publish(self, full: bool) -> list[list[str]]: + """Runs build_source with every command a stand-in, and returns the commands.""" scratch = Path(tempfile.mkdtemp(dir=self.root)) shutil.copytree(self.source, scratch / 'source') + commands: list[list[str]] = [] def command(command: list[str], *, cwd: Path, env: dict, log: Path, timeout: float = 600) -> None: + commands.append(command) log.write_text('completed\n') if command[-1] == 'build_generated': shutil.copytree(self.generated / 'include', cwd / 'include') if command[-1] == 'install_dev': - shutil.copytree(self.generated / 'include', scratch / 'install/include') - (scratch / 'install/lib').mkdir() + # make install_dev writes to $(DESTDIR)$(INSTALLTOP), INSTALLTOP the prefix. + prefix = next(word.split('=', 1)[1] for word in commands[0] + if word.startswith('--prefix=')) + destination = next((word.split('=', 1)[1] for word in command + if word.startswith('DESTDIR=')), '') + install = Path(destination + prefix) + shutil.copytree(self.generated / 'include', install / 'include') + (install / 'lib').mkdir() for name in ('libssl.a', 'libcrypto.a'): - (scratch / 'install/lib' / name).write_bytes(b'archive fixture\n') + (install / 'lib' / name).write_bytes(b'archive fixture\n') args = argparse.Namespace(cc=sys.executable, ar='ar', platform='wasi', threading='single', variant='release', test=False, @@ -62,6 +71,21 @@ def command(command: list[str], *, cwd: Path, env: dict, log: Path, with patch.object(build, 'run', side_effect=command): build.build_source(args, self.output, {'version': 'fixture', 'source_date_epoch': 1700000000}, scratch) + return commands + + def test_the_prefix_is_the_same_wherever_the_library_is_built(self) -> None: + # OpenSSL compiles its prefix into libcrypto (MODULESDIR, ENGINESDIR): a prefix in the + # build's temporary directory made the same program's bytes differ by host and by run. + # Configure takes one fixed prefix, and install_dev stages it under DESTDIR. + commands = self.publish(True) + configure = commands[0] + self.assertIn('--prefix=' + build.PREFIX, configure) + self.assertTrue(build.PREFIX.startswith('/'), build.PREFIX) + install = next(c for c in commands if c[-1] == 'install_dev') + destinations = [word for word in install if word.startswith('DESTDIR=')] + self.assertEqual(len(destinations), 1, install) + self.assertNotIn(build.PREFIX, destinations[0]) + self.assertEqual((self.output / 'libssl.a').read_bytes(), b'archive fixture\n') def test_full_build_keeps_identical_headers_inode_timestamp_and_permissions(self) -> None: self.header.chmod(0o644) From 66e5aa31e19e6d410d1d9c3106ef54ee70f2a48e Mon Sep 17 00:00:00 2001 From: R Date: Mon, 16 Nov 2026 21:28:03 -0300 Subject: [PATCH 3/3] ci: pin the verified environments prepared for the platform-independent wasi-sysroot The preparation run of tools/wasi-sysroot (run 43981425615) published the images whose wasi-sdk bundle holds the three archives the installer reads: wasi-sdk 34.0 for Linux x86_64, wasi-sysroot-34.0 and libclang_rt-34.0. --- tools/ci/environments.json | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/ci/environments.json b/tools/ci/environments.json index f9789639..82341539 100644 --- a/tools/ci/environments.json +++ b/tools/ci/environments.json @@ -5,48 +5,50 @@ "archives": [ "9d96e42f303046fb0b221aa9071eabccc40b9683e0b7af2b02a929d15476ca6a" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:47ffcbe9dff61287e7482efb908e13ba91ac5973efbc964ff228b98a4f633fc1", + "image": "ghcr.io/webcpporg/ci-environment@sha256:1b5e0f6d7876e95c0a38fbcc2f2d027feca6d4538db1fe0a1874b0c38fb78877", "recipe": "1caf5163552b9ba131f4687f9321cf90a157ce02e411d8d3284faf3a63547bbf", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" }, "native-linux-x64": { "archives": [], - "image": "ghcr.io/webcpporg/ci-environment@sha256:c1e7a56dcb3c74bb7431e105e6432d345131ed3fd5d3fbac7c19531e6d5692a4", + "image": "ghcr.io/webcpporg/ci-environment@sha256:f1eaaabce5acda76e57d40170b8be4c8b940688041af942620421551fc30c30f", "recipe": "34fb00b6fe5aebb73082f45019a5ed6a13a2e8fec9f4900d6a278d1a00c236ac", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" }, "wasi-sdk-linux-x64": { "archives": [ - "b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4" + "9d813544eeebe38b7b8f2244ed591de46b6db812c6dd1a257ff9f0d2a905a2be", + "b761e3a0721dbae9c09a0059e5fdb2bf917d1b4a8a7b430fb3b5aafb0984b2c4", + "eee3e634dcf71aa22b1333391623cf5c9965a637dc428a27b1a858c026c587f1" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:fed7836d1847c252bb0a346f1e69aa33f5f3391a17c89aee0b48ec003cec2d91", - "recipe": "605940eca683fa1f9da9d842779fcdd2825582e0315fc9f0da78196231a67b1e", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "image": "ghcr.io/webcpporg/ci-environment@sha256:23c70b9ffea7b84c5cc392fa50b58e529ef8bed19986d8920bab670e2157a697", + "recipe": "a00ab454b3a141598498dae1ea1be18d688ec8b9d546373bc632dce768759cfd", + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" }, "wasi-wit-linux-x64": { "archives": [ "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487", "f1d5749fdf69bb9400562eba50f8f25f5cd800ef4b74300038b6f99ae7409674" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:f05fc9fe2786aed49df98ece6508b57a965ddde00b056aaf1ab2104b17513076", + "image": "ghcr.io/webcpporg/ci-environment@sha256:36d2ef9037418f0a239614092ee7cd8d142d5fa440cb7127915e984253fc995a", "recipe": "a154f6fe1adb7268d5c4f0c6a5e244166d3925fd74d3d125691709067a84209a", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" }, "wasmtime-linux-x64": { "archives": [ "685466455dd42a14774a86c36c8f2e45cbb9bd6d92a850139315df60a75498a5" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:3879086896abc7f0228e174011dedcbe207c4dc0822e1c10034c386f9af7668e", + "image": "ghcr.io/webcpporg/ci-environment@sha256:1dbca1cea71fba2bc988ac15ac2dceafec003cd755c5b3a33e7222138e8b2205", "recipe": "3e46afc7303c53c2161bcc97ff2714fd6a0426aa61dac6cb85f4f56b33bb0101", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" }, "wit-bindgen-linux-x64": { "archives": [ "3e81cc6523729f7532b4aa7968648a04abf0c711b7d1677150e9121f4e6458fe" ], - "image": "ghcr.io/webcpporg/ci-environment@sha256:f6780e906a25d7c6d0de510201bef592761775b2b520e685985a69fd2d78b4b6", + "image": "ghcr.io/webcpporg/ci-environment@sha256:63bb9536dc7102892616a0b6123e6b60546cc161081d2a5df9237bede6d7090c", "recipe": "436fd39c29f16fc56d136cad6ca2f829f984cf536a0abc83f53d8cf23049ad93", - "source": "c41196569b22bd1b0ca80baf4945cd657be15f3f" + "source": "c711c0f1d8faca1650606272a717a8aabf20c838" } }, "schema": 1