From b5c5475d6260d0118ebe931a84f0c36919771e6c Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:46:08 +0100
Subject: [PATCH 01/23] Build the desktop CI jobs with four parallel jobs
[#435]
---
.github/workflows/BuildAndTest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml
index a951ee80..24eedf41 100644
--- a/.github/workflows/BuildAndTest.yml
+++ b/.github/workflows/BuildAndTest.yml
@@ -128,7 +128,7 @@ jobs:
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
${{ matrix.options }}
- name: Build
- run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 2
+ run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 4
- name: Ensure WebView2 Evergreen runtime
if: runner.os == 'Windows'
shell: pwsh
From 6c56179512868370de7c816f0a60a98b9018946a Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:48:12 +0100
Subject: [PATCH 02/23] Add the build-time study workflow and its test options
[#435]
---
.github/workflows/BuildStudy.yml | 142 +++++++++++++++++++++++++++++++
test/tools/BuildStudy.py | 128 ++++++++++++++++++++++++++++
test/tools/BuildStudyReport.py | 47 ++++++++++
test/unit/CMakeLists.txt | 24 ++++++
4 files changed, 341 insertions(+)
create mode 100644 .github/workflows/BuildStudy.yml
create mode 100644 test/tools/BuildStudy.py
create mode 100644 test/tools/BuildStudyReport.py
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
new file mode 100644
index 00000000..7b3a72de
--- /dev/null
+++ b/.github/workflows/BuildStudy.yml
@@ -0,0 +1,142 @@
+name: Build time study
+
+# Measurements for #435, run by hand: each job times one configuration of the tests under the compiler-cache scenarios of a
+# pull request (test/tools/BuildStudy.py) and the report job tabulates them. Nothing here gates a merge.
+on:
+ # Temporary: a workflow absent from the default branch cannot be dispatched, so the study branch runs it on push.
+ push:
+ branches: [435-ci-build-time]
+ paths: ['.github/workflows/BuildStudy.yml', 'test/tools/BuildStudy*.py', 'test/unit/CMakeLists.txt']
+ workflow_dispatch:
+ inputs:
+ variants:
+ description: 'Comma-separated variants to run (empty: all)'
+ default: ''
+
+permissions:
+ contents: read
+
+env:
+ CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
+
+jobs:
+ image:
+ runs-on: ubuntu-24.04
+ outputs:
+ image: ${{ steps.tag.outputs.image }}
+ matrix: ${{ steps.matrix.outputs.matrix }}
+ steps:
+ - uses: actions/checkout@v7
+ - id: tag
+ run: |
+ hash=$(sha256sum .github/docker/linux-ci.Dockerfile | cut -c1-16)
+ echo "image=ghcr.io/${GITHUB_REPOSITORY,,}/linux-ci:$hash" >> "$GITHUB_OUTPUT"
+ - id: matrix
+ env:
+ REQUESTED: ${{ inputs.variants }}
+ run: |
+ python3 - <<'PY' >> "$GITHUB_OUTPUT"
+ import json, os
+ all_variants = ['base-all-j2', 'base-all-j4', 'base-j2', 'base-j4', 'unity-b2', 'unity-b4', 'unity-b8', 'unity-b16',
+ 'unity-heavy-b4', 'unity-heavy-b13', 'pch', 'pch-unity-heavy-b4']
+ requested = [v for v in os.environ.get('REQUESTED', '').replace(' ', '').split(',') if v] or all_variants
+ print('matrix=' + json.dumps({'os': ['windows', 'linux'], 'variant': requested}))
+ PY
+
+ study:
+ needs: image
+ permissions:
+ contents: read
+ packages: read
+ strategy:
+ fail-fast: false
+ matrix: ${{ fromJSON(needs.image.outputs.matrix) }}
+ name: ${{ matrix.os }} ${{ matrix.variant }}
+ runs-on: ${{ matrix.os == 'windows' && 'windows-2025' || 'ubuntu-26.04' }}
+ container: ${{ matrix.os == 'linux' && fromJSON(format('{{"image":"{0}","credentials":{{"username":"{1}","password":"{2}"}},"options":"--shm-size=1g"}}', needs.image.outputs.image, github.actor, github.token)) || '' }}
+ timeout-minutes: 240
+ steps:
+ - uses: actions/checkout@v7
+ - uses: ./.github/actions/remove-node
+ - uses: ./.github/actions/setup-cmake
+ with:
+ version: '4.4.4'
+ - name: Point the CPM cache at the workspace
+ shell: bash
+ run: echo "CPM_SOURCE_CACHE=$GITHUB_WORKSPACE/.cache/CPM" >> "$GITHUB_ENV"
+ - uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
+ - uses: actions/cache@v4
+ with:
+ path: .cache/CPM
+ key: cpm-study-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake', 'test/unit/CMakeLists.txt') }}
+ restore-keys: cpm-study-${{ runner.os }}-
+ - name: Initialize MSVC environment
+ if: matrix.os == 'windows'
+ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
+ - name: Local-disk compiler cache
+ shell: bash
+ run: |
+ echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
+ echo "SCCACHE_DIR=$RUNNER_TEMP/sccache-study" >> "$GITHUB_ENV"
+ echo "SCCACHE_CACHE_SIZE=20G" >> "$GITHUB_ENV"
+ - name: Machine
+ shell: bash
+ run: |
+ cmake --version | head -1
+ (nproc || sysctl -n hw.ncpu || echo "$NUMBER_OF_PROCESSORS") 2>/dev/null
+ (cl 2>&1 | head -1) || g++ --version | head -1
+ - name: Measure
+ shell: bash
+ run: |
+ case "${{ matrix.variant }}" in
+ base-all-j2) jobs=2; target=all; extra="" ;;
+ base-all-j4) jobs=4; target=all; extra="" ;;
+ base-j2) jobs=2; target=tests; extra="" ;;
+ base-j4) jobs=4; target=tests; extra="" ;;
+ unity-b2) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=2" ;;
+ unity-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=4" ;;
+ unity-b8) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=8" ;;
+ unity-b16) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=16" ;;
+ unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ unity-heavy-b13) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=13 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ pch) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON" ;;
+ pch-unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ *) echo "unknown variant"; exit 1 ;;
+ esac
+ if [ "${{ matrix.os }}" = windows ]; then
+ config=Release
+ platform="-DWEBFRONT_EMBED_WEBVIEW2=ON -DWEBFRONT_WEBTEST_FRONTEND=WebView2"
+ else
+ config=Debug
+ platform="-DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK -DENABLE_COVERAGE=ON -DWEBFRONT_REQUIRE_REFLECTION_TESTS=ON"
+ fi
+ # shellcheck disable=SC2086
+ python3 test/tools/BuildStudy.py --name "${{ matrix.os }}-${{ matrix.variant }}" --build-dir study/build \
+ --jobs "$jobs" --target "$target" --config "$config" --output "study/${{ matrix.os }}-${{ matrix.variant }}.json" \
+ -- $platform $extra
+ - uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: study-${{ matrix.os }}-${{ matrix.variant }}
+ path: study/*.json
+ if-no-files-found: ignore
+
+ report:
+ needs: study
+ if: ${{ !cancelled() }}
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/download-artifact@v4
+ with:
+ pattern: study-*
+ path: study-results
+ merge-multiple: true
+ - name: Tabulate
+ run: python3 test/tools/BuildStudyReport.py study-results | tee -a "$GITHUB_STEP_SUMMARY" > study-report.md
+ - uses: actions/upload-artifact@v4
+ with:
+ name: study-report
+ path: |
+ study-report.md
+ study-results/
diff --git a/test/tools/BuildStudy.py b/test/tools/BuildStudy.py
new file mode 100644
index 00000000..40cb53a4
--- /dev/null
+++ b/test/tools/BuildStudy.py
@@ -0,0 +1,128 @@
+"""Build-time study (#435): time one CMake configuration of the tests under the compiler-cache scenarios of a pull request.
+
+Every scenario is a clean build of one target. The compiler cache (sccache, local disk) is empty for `cold`, complete for
+`warm`, and complete except for the translation units that include the file a scenario changed. The changed file is restored
+afterwards. Writes one JSON report (stdlib only)."""
+import argparse
+import json
+import os
+from pathlib import Path
+import re
+import shutil
+import subprocess
+import sys
+
+sys.path.insert(0, str(Path(__file__).parent))
+from MeasureCommand import measure # noqa: E402
+
+ROOT = Path(__file__).resolve().parents[2]
+SCENARIOS = [
+ ('cold', None),
+ ('warm', None),
+ ('header', 'include/webfront/WebFront.hpp'),
+ ('heavy-test', 'test/unit/WebFrontTests.cpp'),
+ ('light-test', 'test/unit/MimeTypeTests.cpp'),
+]
+
+
+def run(command, **kwargs):
+ print('+', ' '.join(map(str, command)), flush=True)
+ return subprocess.run(command, check=True, **kwargs)
+
+
+def sccache_counts():
+ output = subprocess.run(['sccache', '--show-stats'], capture_output=True, text=True, check=True).stdout
+ counts = {}
+ for key in ('Compile requests', 'Cache hits', 'Cache misses'):
+ match = re.search(r'^' + key + r'\s+(\d+)', output, re.MULTILINE)
+ counts[key] = int(match.group(1)) if match else None
+ return counts
+
+
+def ninja_units(build):
+ """(output, milliseconds) of the last build, from .ninja_log (the log keeps the last run of each output)."""
+ units = []
+ log = build / '.ninja_log'
+ if not log.exists():
+ return units
+ for line in log.read_text().splitlines():
+ fields = line.split('\t')
+ if len(fields) >= 4 and fields[0].isdigit():
+ units.append((fields[3], int(fields[1]) - int(fields[0])))
+ return units
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--name', required=True)
+ parser.add_argument('--build-dir', type=Path, required=True)
+ parser.add_argument('--jobs', type=int, required=True)
+ parser.add_argument('--target', default='tests')
+ parser.add_argument('--config', default='Release')
+ parser.add_argument('--output', type=Path, required=True)
+ parser.add_argument('--scenarios', default=','.join(name for name, _ in SCENARIOS))
+ parser.add_argument('cmake_args', nargs=argparse.REMAINDER)
+ args = parser.parse_args()
+ cmake_args = args.cmake_args[1:] if args.cmake_args[:1] == ['--'] else args.cmake_args
+ build = args.build_dir.resolve()
+ wanted = args.scenarios.split(',')
+ results = {'name': args.name, 'jobs': args.jobs, 'target': args.target, 'config': args.config,
+ 'cmake_args': cmake_args, 'platform': sys.platform, 'scenarios': {}}
+
+ def write():
+ args.output.parent.mkdir(parents=True, exist_ok=True)
+ args.output.write_text(json.dumps(results, indent=2) + '\n', encoding='utf-8')
+
+ shutil.rmtree(build, ignore_errors=True)
+ configure = measure_command(['cmake', '-S', str(ROOT), '-B', str(build), '-G', 'Ninja', f'-DCMAKE_BUILD_TYPE={args.config}',
+ '-DENABLE_TESTING=ON', '-DWEBFRONT_EMBED_CEF=OFF', '-DENABLE_CACHE=OFF',
+ '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_SCAN_FOR_MODULES=OFF'] + cmake_args,
+ build.parent / (args.name + '-configure.json'))
+ results['configure_seconds'] = configure['wall_seconds']
+ if configure['exit_code']:
+ results['error'] = 'configure failed'
+ write()
+ return 1
+ subprocess.run(['sccache', '--stop-server'], capture_output=True)
+ subprocess.run(['sccache', '--start-server'], capture_output=True)
+ status = 0
+ for name, changed in SCENARIOS:
+ if name not in wanted:
+ continue
+ original = None
+ if changed:
+ path = ROOT / changed
+ original = path.read_bytes()
+ path.write_bytes(original + b'\n// build study ' + name.encode() + b'\n')
+ try:
+ subprocess.run(['sccache', '--zero-stats'], capture_output=True, check=True)
+ command = ['cmake', '--build', str(build), '--config', args.config, '--target', args.target,
+ '--parallel', str(args.jobs), '--clean-first']
+ report = measure_command(command, build.parent / (args.name + '-' + name + '.json'))
+ counts = sccache_counts()
+ units = sorted(ninja_units(build), key=lambda unit: -unit[1])
+ report.update({'sccache': counts, 'units': len(units),
+ 'unit_seconds_total': sum(ms for _, ms in units) / 1000,
+ 'slowest_units': [{'output': out, 'seconds': ms / 1000} for out, ms in units[:15]]})
+ results['scenarios'][name] = report
+ write()
+ if report['exit_code']:
+ status = 1
+ break
+ finally:
+ if original is not None:
+ path.write_bytes(original)
+ write()
+ return status
+
+
+def measure_command(command, output):
+ code_report = {}
+ exit_code = measure(command, output)
+ code_report.update(json.loads(output.read_text()))
+ code_report['exit_code'] = exit_code
+ return code_report
+
+
+if __name__ == '__main__':
+ raise SystemExit(main())
diff --git a/test/tools/BuildStudyReport.py b/test/tools/BuildStudyReport.py
new file mode 100644
index 00000000..b4e36ff9
--- /dev/null
+++ b/test/tools/BuildStudyReport.py
@@ -0,0 +1,47 @@
+"""Tabulate the reports of BuildStudy.py as Markdown (stdlib only)."""
+import json
+from pathlib import Path
+import sys
+
+ORDER = ['cold', 'warm', 'header', 'heavy-test', 'light-test']
+
+
+def main(directory):
+ reports = [json.loads(path.read_text()) for path in sorted(Path(directory).rglob('*-*.json'))]
+ reports = [report for report in reports if 'scenarios' in report]
+ for system in sorted({report['name'].split('-')[0] for report in reports}):
+ mine = [report for report in reports if report['name'].startswith(system + '-')]
+ print(f'\n### {system}: wall seconds per scenario (clean build of the target)\n')
+ print('| variant | target | jobs | configure | ' + ' | '.join(ORDER) + ' | peak RSS MB (cold) |')
+ print('|---|---|---|---|' + '---|' * len(ORDER) + '---|')
+ for report in mine:
+ cells = []
+ for name in ORDER:
+ scenario = report['scenarios'].get(name)
+ if not scenario:
+ cells.append('-')
+ continue
+ text = f"{scenario['wall_seconds']:.0f}" + ('' if not scenario['exit_code'] else ' FAIL')
+ counts = scenario.get('sccache') or {}
+ if counts.get('Compile requests') is not None:
+ text += f" ({counts['Cache hits']}/{counts['Compile requests']})"
+ cells.append(text)
+ cold = report['scenarios'].get('cold', {})
+ rss = cold.get('sampled_peak_family_rss_bytes', 0) / 1e6
+ variant = report['name'].split('-', 1)[1]
+ print(f"| {variant} | {report['target']} | {report['jobs']} | {report.get('configure_seconds', 0):.0f} | "
+ + ' | '.join(cells) + f' | {rss:.0f} |')
+ print('\nCells are wall seconds, then (sccache hits/requests). Cold: empty cache; warm: complete cache; '
+ 'header/heavy-test/light-test: complete cache, one file changed.\n')
+ for report in mine:
+ cold = report['scenarios'].get('cold')
+ if cold and cold.get('slowest_units') and report['name'].endswith(('-base-j4', '-unity-b4', '-pch')):
+ print(f"{report['name']}: slowest units, cold\n")
+ print('| unit | s |\n|---|---|')
+ for unit in cold['slowest_units'][:10]:
+ print(f"| {unit['output']} | {unit['seconds']:.0f} |")
+ print('\n\n')
+
+
+if __name__ == '__main__':
+ main(sys.argv[1] if len(sys.argv) > 1 else '.')
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index d02fd04e..b6acf8d8 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -47,6 +47,30 @@ if(MSVC)
target_compile_options(tests PRIVATE /bigobj)
endif()
target_compile_definitions(tests PRIVATE WEBFRONT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
+
+# Build-time study (#435), measurements only (docs/BUILD_TIME_STUDY.md): both knobs default to the regular build.
+# WEBFRONT_TEST_UNITY_BATCH=N groups the translation units of `tests` by N (0: no unity build);
+# WEBFRONT_TEST_UNITY_HEAVY=ON limits the grouping to the heavy units (those instantiating a full application);
+# WEBFRONT_TEST_PCH=ON precompiles the headers every test includes.
+set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "Study (#435): UNITY_BUILD_BATCH_SIZE of the tests target, 0 disables it")
+option(WEBFRONT_TEST_UNITY_HEAVY "Study (#435): group only the heavy translation units of the tests target" OFF)
+option(WEBFRONT_TEST_PCH "Study (#435): precompiled headers for the tests target" OFF)
+if(WEBFRONT_TEST_UNITY_BATCH GREATER 0)
+ set_target_properties(tests PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE ${WEBFRONT_TEST_UNITY_BATCH})
+ if(WEBFRONT_TEST_UNITY_HEAVY)
+ set(_heavy WebFrontTests BroadcastTests CommandsTests ApplicationTaskTests StdnetShutdownTests FrontendContractTests
+ JsFunctionSenderTests AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests)
+ foreach(_source IN LISTS TESTS_LIST)
+ cmake_path(GET _source STEM _stem)
+ if(NOT _stem IN_LIST _heavy)
+ set_source_files_properties(${_source} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
+ endif()
+ endforeach()
+ endif()
+endif()
+if(WEBFRONT_TEST_PCH)
+ target_precompile_headers(tests PRIVATE )
+endif()
configure_file(Version.hpp.in generated/Version.hpp @ONLY)
target_include_directories(tests PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated")
From b936616b5ce13a45f6ed35533fb1322937e36cac Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:49:49 +0100
Subject: [PATCH 03/23] Return from RunWithDeadline.sh when the command ends,
not at the deadline [#435]
---
.github/workflows/BuildStudy.yml | 2 +-
cmake/RunWithDeadline.sh | 13 +++++++++----
test/cmake/CheckRunWithDeadline.cmake | 19 +++++++++++++++++++
test/unit/CMakeLists.txt | 3 +++
4 files changed, 32 insertions(+), 5 deletions(-)
create mode 100644 test/cmake/CheckRunWithDeadline.cmake
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index 7b3a72de..a8ec9c56 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -6,7 +6,7 @@ on:
# Temporary: a workflow absent from the default branch cannot be dispatched, so the study branch runs it on push.
push:
branches: [435-ci-build-time]
- paths: ['.github/workflows/BuildStudy.yml', 'test/tools/BuildStudy*.py', 'test/unit/CMakeLists.txt']
+ paths: ['.github/workflows/BuildStudy.yml', 'test/tools/BuildStudy*.py']
workflow_dispatch:
inputs:
variants:
diff --git a/cmake/RunWithDeadline.sh b/cmake/RunWithDeadline.sh
index 7202dbe5..9aafffab 100755
--- a/cmake/RunWithDeadline.sh
+++ b/cmake/RunWithDeadline.sh
@@ -9,14 +9,19 @@ expired=$(mktemp -u)
"$@" &
command_pid=$!
(
- sleep "$limit"
+ sleep "$limit" &
+ sleeper=$!
+ trap 'kill "$sleeper" 2>/dev/null; exit 0' TERM
+ wait "$sleeper" || exit 0
: > "$expired"
- kill -KILL -- "-$command_pid" 2>/dev/null
-) &
+ kill -KILL -- "-$command_pid" 2>/dev/null || kill -KILL "$command_pid" 2>/dev/null
+# The watchdog must not hold the caller's output pipes: the caller waits for them to close, so a sleeping watchdog would
+# delay a command that already finished until the deadline (30 s per Jasmine case under dash, which has no job control here).
+) >/dev/null 2>&1 &
watchdog_pid=$!
wait "$command_pid"
status=$?
-kill -KILL -- "-$watchdog_pid" 2>/dev/null
+kill -TERM "$watchdog_pid" 2>/dev/null
# Whatever the command left behind in its group goes with it.
kill -KILL -- "-$command_pid" 2>/dev/null
# Only the watchdog's flag makes a kill a timeout: an unrelated SIGKILL keeps its own status.
diff --git a/test/cmake/CheckRunWithDeadline.cmake b/test/cmake/CheckRunWithDeadline.cmake
new file mode 100644
index 00000000..dbc72602
--- /dev/null
+++ b/test/cmake/CheckRunWithDeadline.cmake
@@ -0,0 +1,19 @@
+# RunWithDeadline.sh must return when its command does, not when the deadline expires (#435), and still kill at the deadline.
+function(run_timed)
+ string(TIMESTAMP start "%s")
+ execute_process(COMMAND sh "${SCRIPT}" ${ARGN} RESULT_VARIABLE status TIMEOUT 25)
+ string(TIMESTAMP end "%s")
+ math(EXPR elapsed "${end} - ${start}")
+ set(status "${status}" PARENT_SCOPE)
+ set(elapsed "${elapsed}" PARENT_SCOPE)
+endfunction()
+
+run_timed(20 sh -c "exit 3")
+if(NOT status EQUAL 3 OR elapsed GREATER 8)
+ message(FATAL_ERROR "A finished command must return its status at once: status ${status}, ${elapsed} s of a 20 s deadline")
+endif()
+
+run_timed(1 sleep 20)
+if(NOT status EQUAL 124 OR elapsed GREATER 8)
+ message(FATAL_ERROR "A command past its deadline must be killed: status ${status}, ${elapsed} s")
+endif()
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index b6acf8d8..9ecf7471 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -165,6 +165,9 @@ add_test(NAME BootstrapProvisioning
# Windows bash.exe may be the WSL launcher rather than a native Bash runtime.
if(UNIX)
+ add_test(NAME RunWithDeadline COMMAND ${CMAKE_COMMAND} -DSCRIPT=${PROJECT_SOURCE_DIR}/cmake/RunWithDeadline.sh
+ -P ${PROJECT_SOURCE_DIR}/test/cmake/CheckRunWithDeadline.cmake)
+ set_tests_properties(RunWithDeadline PROPERTIES TIMEOUT 60 LABELS fast)
find_program(WEBFRONT_TEST_BASH_EXECUTABLE bash)
find_package(Git QUIET)
if(WEBFRONT_TEST_BASH_EXECUTABLE AND Git_FOUND)
From ada99ee7ea1e38cf75b4c1fbd16d3cbca313fcad Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:54:41 +0100
Subject: [PATCH 04/23] Compile the heavy unit tests as a unity build and study
the variants [#435]
---
.github/workflows/BuildStudy.yml | 18 ++++++++----------
test/unit/CMakeLists.txt | 23 +++++++++++++----------
test/unit/CommandsTests.cpp | 2 +-
test/unit/FrontendContractTests.cpp | 12 ++++++------
test/unit/JsFunctionSenderTests.cpp | 10 +++++-----
test/unit/Mocks.hpp | 2 ++
6 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index a8ec9c56..b041e84d 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -37,8 +37,9 @@ jobs:
run: |
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json, os
- all_variants = ['base-all-j2', 'base-all-j4', 'base-j2', 'base-j4', 'unity-b2', 'unity-b4', 'unity-b8', 'unity-b16',
- 'unity-heavy-b4', 'unity-heavy-b13', 'pch', 'pch-unity-heavy-b4']
+ all_variants = ['base-all-j2', 'base-all-j4', 'base-j2', 'base-j4', 'unity-heavy-b2',
+ 'unity-heavy-b3', 'unity-heavy-b4', 'unity-heavy-b6', 'unity-heavy-b12', 'pch', 'pch-unity-heavy-b4',
+ 'pch-unity-heavy-b12', 'unity-all-b16']
requested = [v for v in os.environ.get('REQUESTED', '').replace(' ', '').split(',') if v] or all_variants
print('matrix=' + json.dumps({'os': ['windows', 'linux'], 'variant': requested}))
PY
@@ -88,19 +89,16 @@ jobs:
- name: Measure
shell: bash
run: |
- case "${{ matrix.variant }}" in
+ v="${{ matrix.variant }}"
+ case "$v" in
base-all-j2) jobs=2; target=all; extra="" ;;
base-all-j4) jobs=4; target=all; extra="" ;;
base-j2) jobs=2; target=tests; extra="" ;;
base-j4) jobs=4; target=tests; extra="" ;;
- unity-b2) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=2" ;;
- unity-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=4" ;;
- unity-b8) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=8" ;;
- unity-b16) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=16" ;;
- unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
- unity-heavy-b13) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=13 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
pch) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON" ;;
- pch-unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ unity-heavy-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=${v#unity-heavy-b} -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ pch-unity-heavy-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON -DWEBFRONT_TEST_UNITY_BATCH=${v#pch-unity-heavy-b} -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ unity-all-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=${v#unity-all-b}" ;;
*) echo "unknown variant"; exit 1 ;;
esac
if [ "${{ matrix.os }}" = windows ]; then
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 9ecf7471..f483ba78 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -55,19 +55,22 @@ target_compile_definitions(tests PRIVATE WEBFRONT_SOURCE_DIR="${PROJECT_SOURCE_D
set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "Study (#435): UNITY_BUILD_BATCH_SIZE of the tests target, 0 disables it")
option(WEBFRONT_TEST_UNITY_HEAVY "Study (#435): group only the heavy translation units of the tests target" OFF)
option(WEBFRONT_TEST_PCH "Study (#435): precompiled headers for the tests target" OFF)
+# The heavy units instantiate a full application; the others are light and keep the regular build.
+set(_heavy WebFrontTests CommandsTests ApplicationTaskTests StdnetShutdownTests FrontendContractTests JsFunctionSenderTests
+ AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests)
if(WEBFRONT_TEST_UNITY_BATCH GREATER 0)
set_target_properties(tests PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE ${WEBFRONT_TEST_UNITY_BATCH})
- if(WEBFRONT_TEST_UNITY_HEAVY)
- set(_heavy WebFrontTests BroadcastTests CommandsTests ApplicationTaskTests StdnetShutdownTests FrontendContractTests
- JsFunctionSenderTests AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests)
- foreach(_source IN LISTS TESTS_LIST)
- cmake_path(GET _source STEM _stem)
- if(NOT _stem IN_LIST _heavy)
- set_source_files_properties(${_source} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
- endif()
- endforeach()
- endif()
endif()
+foreach(_source IN LISTS TESTS_LIST)
+ cmake_path(GET _source STEM _stem)
+ if(NOT _stem IN_LIST _heavy)
+ if(WEBFRONT_TEST_UNITY_HEAVY)
+ set_source_files_properties(${_source} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
+ endif()
+ # WebFront.hpp declares names the light units define themselves (MSVC C4459): they must not receive it.
+ set_source_files_properties(${_source} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+ endif()
+endforeach()
if(WEBFRONT_TEST_PCH)
target_precompile_headers(tests PRIVATE )
endif()
diff --git a/test/unit/CommandsTests.cpp b/test/unit/CommandsTests.cpp
index c528b3a8..4ebaf590 100644
--- a/test/unit/CommandsTests.cpp
+++ b/test/unit/CommandsTests.cpp
@@ -64,7 +64,7 @@ struct FakeApp {
function list;
function start;
function cancel;
- shared_ptr> closed = make_shared>();
+ shared_ptr> closed = make_shared>();
vector calls;
[[nodiscard]] bool hasCppFunction(string_view name) const {
diff --git a/test/unit/FrontendContractTests.cpp b/test/unit/FrontendContractTests.cpp
index 2a12a0f3..9e8ff756 100644
--- a/test/unit/FrontendContractTests.cpp
+++ b/test/unit/FrontendContractTests.cpp
@@ -108,8 +108,8 @@ struct ContractFrontend {
template
void checkSession() {
- using App = BasicWFWithFrontend, ContractFrontend>;
- App app;
+ using ContractApp = BasicWFWithFrontend, ContractFrontend>;
+ ContractApp app;
const auto state = ContractIoContext::current;
std::exception_ptr error;
std::jthread caller([&] {
@@ -164,8 +164,8 @@ void checkSession() {
template
void checkStartupFailure() {
- using App = BasicWFWithFrontend, ContractFrontend>;
- App app;
+ using ContractApp = BasicWFWithFrontend, ContractFrontend>;
+ ContractApp app;
const auto state = ContractIoContext::current;
REQUIRE_THROWS_WITH(app.show(), "frontend failed before window creation");
std::lock_guard lock(state->mutex);
@@ -250,9 +250,9 @@ struct WindowRecorder {
};
WindowOptions windowReceivedBy(WebFrontConfig config) {
- using App = BasicWFWithFrontend, WindowRecorder>;
+ using ContractApp = BasicWFWithFrontend, WindowRecorder>;
WindowRecorder::received = {.title = "unset", .width = -1, .height = -1};
- App app(std::move(config));
+ ContractApp app(std::move(config));
app.show();
app.stop();
return WindowRecorder::received;
diff --git a/test/unit/JsFunctionSenderTests.cpp b/test/unit/JsFunctionSenderTests.cpp
index 51e53b21..53f9cfce 100644
--- a/test/unit/JsFunctionSenderTests.cpp
+++ b/test/unit/JsFunctionSenderTests.cpp
@@ -294,7 +294,7 @@ SCENARIO("Typed browser senders can be awaited in a tracked task") {
SCENARIO("Cancelled correlation IDs cannot be reused before a late reply") {
GIVEN("a registry with one cancelled call") {
- detail::PendingCalls calls;
+ webfront::detail::PendingCalls calls;
auto retained = std::make_shared(42);
std::weak_ptr released = retained;
const auto cancelled = calls.add({[retained](const auto&) { }, [retained](auto) { }});
@@ -407,7 +407,7 @@ SCENARIO("Browser senders reject inconsistent return envelopes") {
SCENARIO("Correlation exhaustion fails until an outstanding reply releases an ID") {
GIVEN("a registry with every ID reserved by an unanswered cancelled call") {
- detail::PendingCalls calls;
+ webfront::detail::PendingCalls calls;
for (std::size_t i = 0; i < std::numeric_limits::max(); ++i) {
const auto id = calls.add({});
calls.cancel(id);
@@ -430,9 +430,9 @@ SCENARIO("Correlation exhaustion fails until an outstanding reply releases an ID
SCENARIO("A sender reports a socket expiring independently of its correlation registry") {
GIVEN("an expired socket and a still-owned registry") {
- auto calls = std::make_shared>();
+ auto calls = std::make_shared>();
std::vector payload(sizeof(msg::FunctionCallHeader));
- detail::BrowserCallSender sender{calls, {}, std::move(payload)};
+ webfront::detail::BrowserCallSender sender{calls, {}, std::move(payload)};
Observed observed;
ex::inplace_stop_source stop;
auto operation = ex::connect(std::move(sender), Receiver{observed, stop.get_token()});
@@ -448,7 +448,7 @@ SCENARIO("A sender reports a socket expiring independently of its correlation re
SCENARIO("An obsolete registration cannot cancel a replacement with the same wire ID") {
GIVEN("a completed call whose operation is still delivering an error") {
- detail::PendingCalls calls;
+ webfront::detail::PendingCalls calls;
int originalOwner{};
int replacementOwner{};
const auto old = calls.add({.complete = [](const auto&) { }, .reject = {}, .owner = &originalOwner});
diff --git a/test/unit/Mocks.hpp b/test/unit/Mocks.hpp
index 5a5394e3..0548a6dc 100644
--- a/test/unit/Mocks.hpp
+++ b/test/unit/Mocks.hpp
@@ -2,6 +2,8 @@
/// @author Ambroise Leclerc
/// @brief Mocks
+#pragma once
+
#include
#include
From 025a4411cef689ca801adffc28329e11ccf90f8f Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:55:53 +0100
Subject: [PATCH 05/23] Profile where the compile time of a heavy unit goes
[#435]
---
.github/workflows/BuildStudy.yml | 57 ++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index b041e84d..e9564aa7 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -119,6 +119,63 @@ jobs:
path: study/*.json
if-no-files-found: ignore
+ # Where does the compile time of one heavy unit go? MSVC /d1reportTime, GCC -ftime-report, Clang -ftime-trace.
+ profile:
+ needs: image
+ permissions:
+ contents: read
+ packages: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [windows, linux, macos]
+ name: profile ${{ matrix.os }}
+ runs-on: ${{ matrix.os == 'windows' && 'windows-2025' || matrix.os == 'macos' && 'macos-26' || 'ubuntu-26.04' }}
+ container: ${{ matrix.os == 'linux' && fromJSON(format('{{"image":"{0}","credentials":{{"username":"{1}","password":"{2}"}},"options":"--shm-size=1g"}}', needs.image.outputs.image, github.actor, github.token)) || '' }}
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@v7
+ - uses: ./.github/actions/remove-node
+ - uses: ./.github/actions/setup-cmake
+ with:
+ version: '4.4.4'
+ - name: Point the CPM cache at the workspace
+ shell: bash
+ run: echo "CPM_SOURCE_CACHE=$GITHUB_WORKSPACE/.cache/CPM" >> "$GITHUB_ENV"
+ - name: Initialize MSVC environment
+ if: matrix.os == 'windows'
+ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
+ - name: Setup Xcode
+ if: matrix.os == 'macos'
+ uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1
+ with:
+ xcode-version: latest
+ - name: Profile the compilation
+ shell: bash
+ run: |
+ case "${{ matrix.os }}" in
+ windows) flags="/d1reportTime"; config=Release ;;
+ linux) flags="-ftime-report"; config=Debug ;;
+ macos) flags="-ftime-trace -ftime-trace-granularity=2000"; config=Release ;;
+ esac
+ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=$config -DENABLE_TESTING=ON -DWEBFRONT_EMBED_CEF=OFF \
+ -DENABLE_CACHE=OFF -DCMAKE_CXX_SCAN_FOR_MODULES=OFF "-DCMAKE_CXX_FLAGS=$flags"
+ mkdir -p profile
+ # One minimal application (HelloWorld) and the two heaviest units of the tests, one at a time (-j1: clean timings).
+ for object in examples/CMakeFiles/HelloWorld.dir/hello-world/HelloWorld.cpp test/unit/CMakeFiles/tests.dir/WebFrontTests.cpp test/unit/CMakeFiles/tests.dir/DeveloperTests.cpp; do
+ suffix=o; [ "${{ matrix.os }}" = windows ] && suffix=obj
+ name=$(basename "$object")
+ ( cd build && ninja -j1 -v "$object.$suffix" ) > "profile/$name.log" 2>&1 || tail -n 30 "profile/$name.log"
+ done
+ find build -name '*.json' -path '*CMakeFiles*' -newer build/CMakeCache.txt -exec cp {} profile/ \; 2>/dev/null || true
+ ls -la profile
+ - uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: profile-${{ matrix.os }}
+ path: profile/
+ if-no-files-found: ignore
+
report:
needs: study
if: ${{ !cancelled() }}
From 981452bb38e4e1508ca9a32762d3e45b22dbce05 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:57:42 +0100
Subject: [PATCH 06/23] Do not hold the port lock while an embedded application
is compiled [#435]
---
test/web/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt
index 7488b3ec..b9b03618 100644
--- a/test/web/CMakeLists.txt
+++ b/test/web/CMakeLists.txt
@@ -411,7 +411,7 @@ if(_browser_tests_available)
--config $ --target life_journey --parallel 2)
# Serialize nested builds and browser executables sharing this output directory, while independent unit tests may run.
set_tests_properties(JourneyEmbeddedBuild PROPERTIES FIXTURES_REQUIRED JourneyEmbedded
- FIXTURES_SETUP JourneyApplication LABELS "web-integration" TIMEOUT 180 RESOURCE_LOCK "webfront_port_9002;webfront_build_tree" PROCESSORS 2)
+ FIXTURES_SETUP JourneyApplication LABELS "web-integration" TIMEOUT 180 RESOURCE_LOCK "webfront_build_tree" PROCESSORS 2)
set(_journey_command "$")
if(_developer_xvfb)
set(_journey_command "${_developer_xvfb}" -a ${_journey_command})
@@ -576,7 +576,7 @@ if(_browser_tests_available)
# Protect the shared build tree and browser DLLs/executables, especially on Windows.
set_tests_properties(LifeEmbeddedBuild PROPERTIES FIXTURES_REQUIRED DeveloperGenerated
FIXTURES_SETUP LifeEmbedded LABELS "web-integration" TIMEOUT 180
- RESOURCE_LOCK "webfront_port_9002;webfront_build_tree" PROCESSORS 2)
+ RESOURCE_LOCK "webfront_build_tree" PROCESSORS 2)
set(_life_command "$")
if(_developer_xvfb)
set(_life_command "${_developer_xvfb}" -a ${_life_command})
From 51d3c35061199507dedb7a8dc04267ea96717c2c Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Fri, 30 Oct 2026 23:58:13 +0100
Subject: [PATCH 07/23] Profile with a flag Git Bash does not rewrite; allow
profile-only runs [#435] [profile-only]
---
.github/workflows/BuildStudy.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index e9564aa7..9d9571ae 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -46,6 +46,8 @@ jobs:
study:
needs: image
+ # A commit message with [profile-only] skips the measurements and runs only the profile job.
+ if: ${{ !contains(github.event.head_commit.message, '[profile-only]') }}
permissions:
contents: read
packages: read
@@ -154,7 +156,7 @@ jobs:
shell: bash
run: |
case "${{ matrix.os }}" in
- windows) flags="/d1reportTime"; config=Release ;;
+ windows) flags="-d1reportTime"; config=Release ;;
linux) flags="-ftime-report"; config=Debug ;;
macos) flags="-ftime-trace -ftime-trace-granularity=2000"; config=Release ;;
esac
@@ -178,7 +180,7 @@ jobs:
report:
needs: study
- if: ${{ !cancelled() }}
+ if: ${{ !cancelled() && !contains(github.event.head_commit.message, '[profile-only]') }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
From e572947e42a6d38c2ab70bf87fc2be036a75a481 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 00:28:41 +0100
Subject: [PATCH 08/23] Measure the cost of MSVC /analyze; select study
variants from the commit message [#435]
[variants:noanalyze,noanalyze-pch,noanalyze-unity-heavy-b4,noanalyze-pch-unity-heavy-b4,base-j4,pch-unity-heavy-b4]
---
.github/workflows/BuildStudy.yml | 15 ++++++++++++---
cmake/CompilerWarnings.cmake | 6 ++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index 9d9571ae..a856d623 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -34,20 +34,24 @@ jobs:
- id: matrix
env:
REQUESTED: ${{ inputs.variants }}
+ MESSAGE: ${{ github.event.head_commit.message }}
run: |
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json, os
all_variants = ['base-all-j2', 'base-all-j4', 'base-j2', 'base-j4', 'unity-heavy-b2',
'unity-heavy-b3', 'unity-heavy-b4', 'unity-heavy-b6', 'unity-heavy-b12', 'pch', 'pch-unity-heavy-b4',
- 'pch-unity-heavy-b12', 'unity-all-b16']
- requested = [v for v in os.environ.get('REQUESTED', '').replace(' ', '').split(',') if v] or all_variants
+ 'pch-unity-heavy-b12', 'unity-all-b16', 'noanalyze', 'noanalyze-pch', 'noanalyze-unity-heavy-b4',
+ 'noanalyze-pch-unity-heavy-b4']
+ import re
+ tagged = re.search(r'\[variants:([^\]]*)\]', os.environ.get('MESSAGE', '')) # a push selects variants this way
+ requested = [v for v in (tagged.group(1) if tagged else os.environ.get('REQUESTED', '')).replace(' ', '').split(',') if v] or all_variants
print('matrix=' + json.dumps({'os': ['windows', 'linux'], 'variant': requested}))
PY
study:
needs: image
# A commit message with [profile-only] skips the measurements and runs only the profile job.
- if: ${{ !contains(github.event.head_commit.message, '[profile-only]') }}
+ if: ${{ !contains(github.event.head_commit.message, '[profile-only]') && !(matrix.os == 'linux' && startsWith(matrix.variant, 'noanalyze')) }}
permissions:
contents: read
packages: read
@@ -98,6 +102,10 @@ jobs:
base-j2) jobs=2; target=tests; extra="" ;;
base-j4) jobs=4; target=tests; extra="" ;;
pch) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON" ;;
+ noanalyze) jobs=4; target=tests; extra="-DWEBFRONT_MSVC_ANALYZE=OFF" ;;
+ noanalyze-pch) jobs=4; target=tests; extra="-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_TEST_PCH=ON" ;;
+ noanalyze-unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
+ noanalyze-pch-unity-heavy-b4) jobs=4; target=tests; extra="-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_TEST_PCH=ON -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
unity-heavy-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=${v#unity-heavy-b} -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
pch-unity-heavy-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_PCH=ON -DWEBFRONT_TEST_UNITY_BATCH=${v#pch-unity-heavy-b} -DWEBFRONT_TEST_UNITY_HEAVY=ON" ;;
unity-all-b*) jobs=4; target=tests; extra="-DWEBFRONT_TEST_UNITY_BATCH=${v#unity-all-b}" ;;
@@ -124,6 +132,7 @@ jobs:
# Where does the compile time of one heavy unit go? MSVC /d1reportTime, GCC -ftime-report, Clang -ftime-trace.
profile:
needs: image
+ if: ${{ !contains(github.event.head_commit.message, '[variants:') }}
permissions:
contents: read
packages: read
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake
index 8fb735a6..2657516a 100644
--- a/cmake/CompilerWarnings.cmake
+++ b/cmake/CompilerWarnings.cmake
@@ -4,6 +4,8 @@
function(set_project_warnings project_name)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
+ # MSVC /analyze roughly doubles the front-end work of every unit (#435): OFF is for measuring that cost, not for CI.
+ option(WEBFRONT_MSVC_ANALYZE "Run the MSVC code analysis while compiling" ON)
set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
@@ -35,6 +37,10 @@ function(set_project_warnings project_name)
/permissive- # standards conformance mode for MSVC compiler.
)
+ if(NOT WEBFRONT_MSVC_ANALYZE)
+ list(FILTER MSVC_WARNINGS EXCLUDE REGEX "^/analyze")
+ endif()
+
set(CLANG_WARNINGS
-Wall
-Wextra # reasonable and standard
From 49b9c2d2d65efece9d313cfca106bdab7f843163 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 00:36:13 +0100
Subject: [PATCH 09/23] Give the command its own process group when the shell
has no job control [#435]
---
cmake/RunWithDeadline.sh | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/cmake/RunWithDeadline.sh b/cmake/RunWithDeadline.sh
index 9aafffab..e0e6c229 100755
--- a/cmake/RunWithDeadline.sh
+++ b/cmake/RunWithDeadline.sh
@@ -4,9 +4,20 @@
# the command started cannot outlive it. Exits with 124 on a timeout (the command was killed), else with its status.
limit=$1
shift
-set -m
expired=$(mktemp -u)
-"$@" &
+# The command needs its own process group for the deadline to reach everything it started. Job control gives it one; dash
+# without a terminal accepts `set -m` yet keeps job control off (and then a group kill reaches nothing), where setsid gives it one instead.
+{ set -m; } 2>/dev/null
+case $- in
+ *m*) "$@" & ;;
+ *)
+ if command -v setsid >/dev/null 2>&1; then
+ setsid "$@" &
+ else
+ "$@" &
+ fi
+ ;;
+esac
command_pid=$!
(
sleep "$limit" &
@@ -14,7 +25,7 @@ command_pid=$!
trap 'kill "$sleeper" 2>/dev/null; exit 0' TERM
wait "$sleeper" || exit 0
: > "$expired"
- kill -KILL -- "-$command_pid" 2>/dev/null || kill -KILL "$command_pid" 2>/dev/null
+ kill -s KILL -- "-$command_pid" 2>/dev/null || kill -KILL "$command_pid" 2>/dev/null
# The watchdog must not hold the caller's output pipes: the caller waits for them to close, so a sleeping watchdog would
# delay a command that already finished until the deadline (30 s per Jasmine case under dash, which has no job control here).
) >/dev/null 2>&1 &
@@ -23,7 +34,7 @@ wait "$command_pid"
status=$?
kill -TERM "$watchdog_pid" 2>/dev/null
# Whatever the command left behind in its group goes with it.
-kill -KILL -- "-$command_pid" 2>/dev/null
+kill -s KILL -- "-$command_pid" 2>/dev/null
# Only the watchdog's flag makes a kill a timeout: an unrelated SIGKILL keeps its own status.
if [ -e "$expired" ]; then
rm -f "$expired"
From 08b43ddad08006cbb6df4ab000fe244638b7a6db Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 00:36:57 +0100
Subject: [PATCH 10/23] Build the study matrix as an include list; no matrix in
a job condition [#435]
[variants:noanalyze,noanalyze-pch,noanalyze-unity-heavy-b4,noanalyze-pch-unity-heavy-b4,base-j4,pch-unity-heavy-b4]
---
.github/workflows/BuildStudy.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index a856d623..2cf0be50 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -45,13 +45,15 @@ jobs:
import re
tagged = re.search(r'\[variants:([^\]]*)\]', os.environ.get('MESSAGE', '')) # a push selects variants this way
requested = [v for v in (tagged.group(1) if tagged else os.environ.get('REQUESTED', '')).replace(' ', '').split(',') if v] or all_variants
- print('matrix=' + json.dumps({'os': ['windows', 'linux'], 'variant': requested}))
+ # /analyze exists on MSVC only: its variants have no Linux counterpart.
+ include = [{'os': o, 'variant': v} for v in requested for o in ('windows', 'linux') if not (o == 'linux' and v.startswith('noanalyze'))]
+ print('matrix=' + json.dumps({'include': include}))
PY
study:
needs: image
# A commit message with [profile-only] skips the measurements and runs only the profile job.
- if: ${{ !contains(github.event.head_commit.message, '[profile-only]') && !(matrix.os == 'linux' && startsWith(matrix.variant, 'noanalyze')) }}
+ if: ${{ !contains(github.event.head_commit.message, '[profile-only]') }}
permissions:
contents: read
packages: read
From 19448b729fa8c7d5f20fc9e42c17bf540ad2bf90 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 00:59:02 +0100
Subject: [PATCH 11/23] Repeat the Windows measurements and report their spread
[#435] [windows-reps:3]
[variants:base-j2,base-j4,base-all-j2,base-all-j4,unity-heavy-b4,unity-heavy-b12,noanalyze,noanalyze-unity-heavy-b4,pch]
---
.github/workflows/BuildStudy.yml | 12 ++++++++----
test/tools/BuildStudy.py | 7 ++++---
test/tools/BuildStudyReport.py | 23 ++++++++++++++++-------
3 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index 2cf0be50..2e1cc34f 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -46,7 +46,11 @@ jobs:
tagged = re.search(r'\[variants:([^\]]*)\]', os.environ.get('MESSAGE', '')) # a push selects variants this way
requested = [v for v in (tagged.group(1) if tagged else os.environ.get('REQUESTED', '')).replace(' ', '').split(',') if v] or all_variants
# /analyze exists on MSVC only: its variants have no Linux counterpart.
- include = [{'os': o, 'variant': v} for v in requested for o in ('windows', 'linux') if not (o == 'linux' and v.startswith('noanalyze'))]
+ reps = re.search(r'\[windows-reps:(\d+)\]', os.environ.get('MESSAGE', ''))
+ # Hosted Windows runners vary a lot from one job to the next: repeat there, Linux is stable.
+ count = {'windows': int(reps.group(1)) if reps else 1, 'linux': 1}
+ include = [{'os': o, 'variant': v, 'rep': r} for v in requested for o in ('windows', 'linux') for r in range(1, count[o] + 1)
+ if not (o == 'linux' and v.startswith('noanalyze'))]
print('matrix=' + json.dumps({'include': include}))
PY
@@ -60,7 +64,7 @@ jobs:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.image.outputs.matrix) }}
- name: ${{ matrix.os }} ${{ matrix.variant }}
+ name: ${{ matrix.os }} ${{ matrix.variant }} #${{ matrix.rep }}
runs-on: ${{ matrix.os == 'windows' && 'windows-2025' || 'ubuntu-26.04' }}
container: ${{ matrix.os == 'linux' && fromJSON(format('{{"image":"{0}","credentials":{{"username":"{1}","password":"{2}"}},"options":"--shm-size=1g"}}', needs.image.outputs.image, github.actor, github.token)) || '' }}
timeout-minutes: 240
@@ -122,12 +126,12 @@ jobs:
fi
# shellcheck disable=SC2086
python3 test/tools/BuildStudy.py --name "${{ matrix.os }}-${{ matrix.variant }}" --build-dir study/build \
- --jobs "$jobs" --target "$target" --config "$config" --output "study/${{ matrix.os }}-${{ matrix.variant }}.json" \
+ --jobs "$jobs" --target "$target" --config "$config" --rep ${{ matrix.rep }} --output "study/${{ matrix.os }}-${{ matrix.variant }}-r${{ matrix.rep }}.json" \
-- $platform $extra
- uses: actions/upload-artifact@v4
if: always()
with:
- name: study-${{ matrix.os }}-${{ matrix.variant }}
+ name: study-${{ matrix.os }}-${{ matrix.variant }}-r${{ matrix.rep }}
path: study/*.json
if-no-files-found: ignore
diff --git a/test/tools/BuildStudy.py b/test/tools/BuildStudy.py
index 40cb53a4..a0194bf3 100644
--- a/test/tools/BuildStudy.py
+++ b/test/tools/BuildStudy.py
@@ -60,13 +60,14 @@ def main():
parser.add_argument('--target', default='tests')
parser.add_argument('--config', default='Release')
parser.add_argument('--output', type=Path, required=True)
+ parser.add_argument('--rep', type=int, default=1)
parser.add_argument('--scenarios', default=','.join(name for name, _ in SCENARIOS))
parser.add_argument('cmake_args', nargs=argparse.REMAINDER)
args = parser.parse_args()
cmake_args = args.cmake_args[1:] if args.cmake_args[:1] == ['--'] else args.cmake_args
build = args.build_dir.resolve()
wanted = args.scenarios.split(',')
- results = {'name': args.name, 'jobs': args.jobs, 'target': args.target, 'config': args.config,
+ results = {'name': args.name, 'rep': args.rep, 'jobs': args.jobs, 'target': args.target, 'config': args.config,
'cmake_args': cmake_args, 'platform': sys.platform, 'scenarios': {}}
def write():
@@ -77,7 +78,7 @@ def write():
configure = measure_command(['cmake', '-S', str(ROOT), '-B', str(build), '-G', 'Ninja', f'-DCMAKE_BUILD_TYPE={args.config}',
'-DENABLE_TESTING=ON', '-DWEBFRONT_EMBED_CEF=OFF', '-DENABLE_CACHE=OFF',
'-DCMAKE_CXX_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_SCAN_FOR_MODULES=OFF'] + cmake_args,
- build.parent / (args.name + '-configure.json'))
+ build.parent / (args.name + f'-r{args.rep}-configure.json'))
results['configure_seconds'] = configure['wall_seconds']
if configure['exit_code']:
results['error'] = 'configure failed'
@@ -98,7 +99,7 @@ def write():
subprocess.run(['sccache', '--zero-stats'], capture_output=True, check=True)
command = ['cmake', '--build', str(build), '--config', args.config, '--target', args.target,
'--parallel', str(args.jobs), '--clean-first']
- report = measure_command(command, build.parent / (args.name + '-' + name + '.json'))
+ report = measure_command(command, build.parent / (args.name + f'-r{args.rep}-' + name + '.json'))
counts = sccache_counts()
units = sorted(ninja_units(build), key=lambda unit: -unit[1])
report.update({'sccache': counts, 'units': len(units),
diff --git a/test/tools/BuildStudyReport.py b/test/tools/BuildStudyReport.py
index b4e36ff9..dab0e340 100644
--- a/test/tools/BuildStudyReport.py
+++ b/test/tools/BuildStudyReport.py
@@ -1,5 +1,6 @@
"""Tabulate the reports of BuildStudy.py as Markdown (stdlib only)."""
import json
+import statistics
from pathlib import Path
import sys
@@ -8,7 +9,12 @@
def main(directory):
reports = [json.loads(path.read_text()) for path in sorted(Path(directory).rglob('*-*.json'))]
- reports = [report for report in reports if 'scenarios' in report]
+ # A name may be reported by several runs (repetitions) and by the per-step JSON: keep the last full report of each.
+ runs = {}
+ for report in reports:
+ if 'scenarios' in report:
+ runs.setdefault(report['name'], {})[report.get('rep', 1)] = report
+ reports = [{'reps': list(by_rep.values()), **next(iter(by_rep.values()))} for by_rep in runs.values()]
for system in sorted({report['name'].split('-')[0] for report in reports}):
mine = [report for report in reports if report['name'].startswith(system + '-')]
print(f'\n### {system}: wall seconds per scenario (clean build of the target)\n')
@@ -17,21 +23,24 @@ def main(directory):
for report in mine:
cells = []
for name in ORDER:
- scenario = report['scenarios'].get(name)
- if not scenario:
+ scenarios = [rep['scenarios'][name] for rep in report['reps'] if name in rep['scenarios']]
+ if not scenarios:
cells.append('-')
continue
- text = f"{scenario['wall_seconds']:.0f}" + ('' if not scenario['exit_code'] else ' FAIL')
- counts = scenario.get('sccache') or {}
+ walls = sorted(scenario['wall_seconds'] for scenario in scenarios)
+ text = f"{statistics.median(walls):.0f}" + (' FAIL' if any(scenario['exit_code'] for scenario in scenarios) else '')
+ if len(walls) > 1:
+ text += f" [{walls[0]:.0f}-{walls[-1]:.0f}]"
+ counts = scenarios[0].get('sccache') or {}
if counts.get('Compile requests') is not None:
text += f" ({counts['Cache hits']}/{counts['Compile requests']})"
cells.append(text)
cold = report['scenarios'].get('cold', {})
rss = cold.get('sampled_peak_family_rss_bytes', 0) / 1e6
variant = report['name'].split('-', 1)[1]
- print(f"| {variant} | {report['target']} | {report['jobs']} | {report.get('configure_seconds', 0):.0f} | "
+ print(f"| {variant}{' x' + str(len(report['reps'])) if len(report['reps']) > 1 else ''} | {report['target']} | {report['jobs']} | {report.get('configure_seconds', 0):.0f} | "
+ ' | '.join(cells) + f' | {rss:.0f} |')
- print('\nCells are wall seconds, then (sccache hits/requests). Cold: empty cache; warm: complete cache; '
+ print('\nCells are the median wall seconds over the repetitions, [min-max] when repeated, then (sccache hits/requests of the first). Cold: empty cache; warm: complete cache; '
'header/heavy-test/light-test: complete cache, one file changed.\n')
for report in mine:
cold = report['scenarios'].get('cold')
From 3f502c06e5ac9447d9ea695961f1011ece336b15 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 02:45:50 +0100
Subject: [PATCH 12/23] Change a declaration, not a comment, in the study
scenarios; repeat Linux on request [#435] [windows-reps:0] [linux-reps:2]
[variants:base-j4,unity-heavy-b4,unity-heavy-b6,unity-heavy-b12,pch]
---
.github/workflows/BuildStudy.yml | 3 ++-
test/tools/BuildStudy.py | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/BuildStudy.yml b/.github/workflows/BuildStudy.yml
index 2e1cc34f..3ffe9e42 100644
--- a/.github/workflows/BuildStudy.yml
+++ b/.github/workflows/BuildStudy.yml
@@ -48,7 +48,8 @@ jobs:
# /analyze exists on MSVC only: its variants have no Linux counterpart.
reps = re.search(r'\[windows-reps:(\d+)\]', os.environ.get('MESSAGE', ''))
# Hosted Windows runners vary a lot from one job to the next: repeat there, Linux is stable.
- count = {'windows': int(reps.group(1)) if reps else 1, 'linux': 1}
+ linux = re.search(r'\[linux-reps:(\d+)\]', os.environ.get('MESSAGE', ''))
+ count = {'windows': int(reps.group(1)) if reps else 1, 'linux': int(linux.group(1)) if linux else 1}
include = [{'os': o, 'variant': v, 'rep': r} for v in requested for o in ('windows', 'linux') for r in range(1, count[o] + 1)
if not (o == 'linux' and v.startswith('noanalyze'))]
print('matrix=' + json.dumps({'include': include}))
diff --git a/test/tools/BuildStudy.py b/test/tools/BuildStudy.py
index a0194bf3..fc55dc38 100644
--- a/test/tools/BuildStudy.py
+++ b/test/tools/BuildStudy.py
@@ -94,7 +94,13 @@ def write():
if changed:
path = ROOT / changed
original = path.read_bytes()
- path.write_bytes(original + b'\n// build study ' + name.encode() + b'\n')
+ # A comment vanishes in preprocessing, and a preprocessor-keyed cache (GCC) would still hit: add a declaration.
+ identifier = 'build_study_' + name.replace('-', '_')
+ if path.suffix == '.hpp':
+ addition = f'\nnamespace webfront {{ inline constexpr int {identifier} = 0; }}\n'
+ else:
+ addition = f'\nnamespace {{ [[maybe_unused]] constexpr int {identifier} = 0; }}\n'
+ path.write_bytes(original + addition.encode())
try:
subprocess.run(['sccache', '--zero-stats'], capture_output=True, check=True)
command = ['cmake', '--build', str(build), '--config', args.config, '--target', args.target,
From d349f2c3380a875ab0a9be33c6def66fe4724e2d Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 07:30:41 +0100
Subject: [PATCH 13/23] Compile the heavy unit tests in groups of four on the
desktop jobs and report the study [#435]
---
.github/workflows/BuildAndTest.yml | 2 +
docs/BUILD_TIME_STUDY.md | 173 +++++++++++++++++++++++++++++
docs/CHANGELOG.md | 8 ++
docs/TEST_PERFORMANCE.md | 3 +
test/unit/CMakeLists.txt | 11 +-
5 files changed, 192 insertions(+), 5 deletions(-)
create mode 100644 docs/BUILD_TIME_STUDY.md
diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml
index 24eedf41..2c657fd2 100644
--- a/.github/workflows/BuildAndTest.yml
+++ b/.github/workflows/BuildAndTest.yml
@@ -120,12 +120,14 @@ jobs:
command -v sccache
sccache --version
# ENABLE_CACHE controls automatic ccache discovery; the explicit sccache launcher stays enabled.
+ # The heavy unit tests are compiled four to a file (docs/BUILD_TIME_STUDY.md); the portability and sanitizer jobs keep one object per test file.
- name: Configure
run: >-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON
-DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
+ -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON
${{ matrix.options }}
- name: Build
run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 4
diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md
new file mode 100644
index 00000000..958aff73
--- /dev/null
+++ b/docs/BUILD_TIME_STUDY.md
@@ -0,0 +1,173 @@
+# Pull-request CI time: measurements and decisions (#435)
+
+This report answers #435. Every number comes from a GitHub-hosted runner, measured by the `Build time study` workflow
+(`.github/workflows/BuildStudy.yml`, driven by `test/tools/BuildStudy.py`, tabulated by `test/tools/BuildStudyReport.py`)
+or read from the artifacts of `BuildAndTest.yml`. The workflow is a measuring instrument: it gates nothing.
+
+## Method
+
+Each study job configures `tests` the way CI does (Windows: Release, MSVC, WebView2; Linux: Debug, GCC 16, coverage,
+WebKitGTK; both with `-DENABLE_TESTING=ON`), with a local-disk sccache, then times clean builds of one target:
+
+| Scenario | Compiler cache | What it models |
+|---|---|---|
+| `cold` | empty | first build of a branch, or a cache that expired |
+| `warm` | complete | a rerun with no source change |
+| `header` | complete, but `include/webfront/WebFront.hpp` changed | a pull request that touches the core header (#400, #401, #428) |
+| `heavy-test` | complete, but `WebFrontTests.cpp` changed | a pull request that edits one heavy test |
+| `light-test` | complete, but `MimeTypeTests.cpp` changed | a pull request that edits one light test |
+
+A cell is wall seconds. Linux cells are stable (two runs of the same variant: 170 and 172 s cold). **Hosted Windows runners are
+not**: the same `base-j4` configuration took 725 s and 466 s cold in two runs. Windows variants are therefore repeated three
+times and reported as a median with its range; a Windows difference smaller than that range is not a result.
+
+## Where the compile time goes
+
+Heavy units are the ones that instantiate a full application (`BasicWF` on stdnet with a frontend). Even the smallest one,
+`HelloWorld.cpp`, costs 61 s on MSVC.
+
+| Compiler | Unit | Total | Parse of headers | Template instantiation | Optimise and generate |
+|---|---|---|---|---|---|
+| GCC 16, Debug + coverage | `HelloWorld.cpp` | 11.2 s | 21 % | 23 % | 49 % |
+| GCC 16, Debug + coverage | `WebFrontTests.cpp` | 22.1 s | 12 % | 22 % | 56 % |
+| Apple Clang, Release | `HelloWorld.cpp` | 21.6 s | frontend 11.9 s (sources 5.5 s) | `BasicWF` 8.5 s inclusive | backend 9.6 s |
+| Apple Clang, Release | `WebFrontTests.cpp` | 53.2 s | frontend 19.7 s | mock `BasicWF` instantiations 6 to 9 s each | backend 33.1 s |
+| MSVC, Release | `HelloWorld.cpp` | 61 s | `WebFront.hpp` alone 8.2 s | | |
+
+On MSVC the `/d1reportTime` report is printed twice, once per front-end pass; the `/analyze` section below measures what that costs.
+
+Across the translation units of `tests` (Clang `-ftime-trace`, 1,786 s of compile), identical `webfront::` and `stdexec::`
+function instantiations that appear in more than one unit account for at most 165 s (9 %, an upper bound: nested
+instantiations are counted at each level). That bounds what any sharing of instantiations could save.
+
+## Results
+
+### Parallelism: `--parallel 2` or `--parallel 4`
+
+Cold wall seconds. Windows: median and [range] of three runs; Linux: every run (a hosted Linux runner also varies, by up to
+1.5x for `all`).
+
+| Target | Linux `-j2` | Linux `-j4` | Windows `-j2` | Windows `-j4` |
+|---|---|---|---|---|
+| `tests` | 285, 275 | 170, 172, 138, 181, 224 | 822 [757-828] | 640 [537-725] |
+| `all` (what CI builds) | 515, 522 | 255, 376 | 1240 [1213-1253] | 1076 [786-1086] |
+
+`-j4` shortens every build: about 40 % on Linux, 13 to 22 % on Windows, where the runner spread is as wide as the gain. The
+peak resident set of the whole process family stays under 1 GB (996 MB for `all` on Windows), well inside the 16 GB of a
+hosted runner. Adopted (`BuildAndTest.yml`, desktop jobs).
+
+### Grouping the heavy units of `tests`
+
+`WEBFRONT_TEST_UNITY_BATCH=N` with `WEBFRONT_TEST_UNITY_HEAVY=ON` compiles the 12 heavy units of `tests` N to a file and
+leaves the 140 light units alone. The `header`, `heavy-test` and `light-test` columns are the cost of a pull request that
+changes `WebFront.hpp`, `WebFrontTests.cpp` or `MimeTypeTests.cpp` with a complete cache.
+
+Windows (median [range] of three runs, `-j4`):
+
+| Variant | cold | warm | header | heavy-test | light-test | peak RSS MB |
+|---|---|---|---|---|---|---|
+| no grouping | 640 [537-725] | 32 | 298 [252-339] | 102 [87-115] | 33 | 858 |
+| groups of 4 | **355 [334-576]** | 18 | **111 [104-182]** | **74 [69-118]** | 19 | 569 |
+| groups of 12 | 501 [297-511] | 29 | 166 [111-166] | 163 [113-169] | 30 | **460** |
+
+Linux (two runs, `-j4`):
+
+| Variant | cold | warm | header | heavy-test | light-test | peak RSS MB |
+|---|---|---|---|---|---|---|
+| no grouping | 202 [181-224] | 6 | 88 [80-95] | 43 [41-44] | 7 | 704 |
+| groups of 4 | **143 [102-185]** | 4 | **45 [35-54]** | **40 [32-48]** | 6 | 553 |
+| groups of 6 | 172 [169-174] | 5 | 57 [57-58] | 56 [56-57] | 6 | 518 |
+| groups of 12 | 166 [162-171] | 5 | 76 [75-78] | 77 [74-80] | 6 | 506 |
+
+Groups of 4 win on both compilers in every scenario: the unit of work stays small enough to spread over four jobs, and a
+change to one heavy test recompiles at most three others. Groups of 12 put every heavy test behind one compilation, which is
+slowest when one of them changes. Grouping every unit instead of the heavy ones does not compile (`GzipExecutorTests.cpp`,
+`DeveloperTests.cpp` and others define the same names); the heavy units needed four qualifications (`detail::` made
+ambiguous by `using namespace webfront`, a local alias that shadowed a file-scope one, and a header without
+`#pragma once`) and the whole suite passes. Adopted for the desktop CI jobs only (`BuildAndTest.yml`): the default build
+keeps one object per test file, and the portability and sanitizer jobs still compile each file alone, which would expose
+a clash that grouping hides.
+
+### Precompiled headers
+
+`WEBFRONT_TEST_PCH=ON` precompiles Catch2 and `WebFront.hpp` for the heavy units.
+
+| | Windows cold | Windows warm | Windows header | Linux cold | Linux header |
+|---|---|---|---|---|---|
+| no grouping, no PCH | 640 | 32 | 298 | 202 | 88 |
+| PCH | 592 [591-601] | **231** | 227 | 215 | 96 |
+
+sccache cannot cache an MSVC compilation that uses a precompiled header, so every PCH unit is recompiled even with a complete
+cache (warm 231 s instead of 32 s) and the build uses 1.7 GB. On GCC it is slower than no PCH. **Not adopted.**
+
+### MSVC `/analyze`
+
+`cmake/CompilerWarnings.cmake` compiles every unit with `/analyze`. `-DWEBFRONT_MSVC_ANALYZE=OFF` (the default is ON) measures
+its cost on `tests` with `-j4`:
+
+| | cold | header | heavy-test |
+|---|---|---|---|
+| `/analyze` (CI) | 640 [537-725] | 298 [252-339] | 102 [87-115] |
+| without | 497 [474-517] | 230 [225-231] | 80 [80-82] |
+| groups of 4, without | 263 [259-420] | 82 [80-133] | 49 [48-83] |
+
+The analysis costs about 22 % of a Windows build. It is a quality gate (warnings are errors), so removing it from the
+desktop job is a decision for the maintainers, not a build-time tweak. One way to keep the gate and the speed is to run it
+in the portability job on pull requests into `master` only. **Not adopted; the option remains for measuring.**
+
+### What the pull request gains
+
+Test suite wall time on the pull request's own CI against run 41134609687 (same jobs, the compiler cache warm in both):
+
+| | Linux | Windows |
+|---|---|---|
+| Suite wall time | 256 s -> 174 s | 272 s -> 106 s |
+| Worker time (sum of cases) | 869 s -> 576 s | 753 s -> 405 s |
+| Dependency chain | 161 s -> 169 s | 143 s -> 62 s |
+
+The Linux gain is the 180 s of `ConsumerJasmine-*` that was waiting for nothing. The Windows chain shortened because
+`LifeEmbeddedBuild` no longer waits behind the port lock and, this time, hit the compiler cache; part of the Windows gain is
+therefore a faster runner and warm caches, and only the Linux figure is a clean before/after.
+
+
+## Run time
+
+The suite takes 256 s on Linux and 271 s on Windows (run 41134609687). Measured from `ctest-graph.json` and the JUnit timings:
+
+- **The dependency chain** is `SelfBuildSession` -> `DeveloperFixtures` -> `DeveloperBrowserIntegration` -> `LifeEmbeddedBuild`
+ -> `LifeEmbeddedIntegration` (161 s on Linux, 143 s on Windows). `DeveloperFixtures` assembles the environment that
+ `SelfBuildSession` builds from the current sources and `DeveloperBrowserIntegration` runs it: the order is the point of
+ the tests, so the fixtures cannot be shared to shorten it. `DeveloperBrowserIntegration` alone is 59 to 113 s; most of
+ it is one test process (`terminal and sessions` 32 s, `Life preview and bridge` 21 s, `Jasmine runs` 17 s on Linux), so
+ splitting it into independent CTest cases is the only way to shorten the chain further.
+- **The port lock** `webfront_port_9002` serialised 175 s (Linux) and 203 s (Windows) of tests, which is why the suite did
+ not scale with the number of workers. 22 and 23 cases hold it. Two of them, `JourneyEmbeddedBuild` and
+ `LifeEmbeddedBuild`, only compile (48 s each on Windows, uncached) and bind no port; they still held it. They now hold
+ `webfront_build_tree` alone.
+- **`ConsumerJasmine-*` took 30.0 s each on Linux** (six cases, 180 s of worker time) for no work: `RunWithDeadline.sh`
+ left a watchdog `sleep` holding the output pipe, so `execute_process` returned only when the deadline expired. Under
+ dash, which `/bin/sh` is on Ubuntu, `set -m` succeeds without enabling job control, so the group kill of the same script
+ also reached nothing. The script now returns when the command does and gives the command a process group with
+ `setsid`. `RunWithDeadline` is the regression test.
+- **Consumer projects** (`FrontendConsumerConfiguration` 67 s, `AddSubdirectoryNativeConsumer` 64 s on Windows) configure and
+ build separate projects on purpose: each case proves a different option set from a clean state. They are off the
+ dependency path, and with the suite bounded by its lock and chain rather than by its workers, parallelising them would not
+ shorten the wall time.
+
+## What was not adopted, and why
+
+- **Sharing objects between executables.** `life_journey` and `life_embedded` compile the same `LifeEmbeddedTest.cpp`
+ against two different generated asset headers; the filesystem type is a template argument of the application, so the two
+ objects differ. The developer application is instantiated with a different frontend or filesystem type in
+ `webfront-agent`, `webfront-wf`, `developer_integration` and `DeveloperTests`. The 9 % ceiling above is what an
+ `extern template` scheme could reach, at the price of explicitly instantiating `stdexec` internals.
+- **Merging small executables.** `jasmine_consumer`, `frontend_lifecycle` and `webview2_*` each cost 66 to 69 s on MSVC and
+ each instantiates its own frontend type, so a merged executable would still instantiate every type once. The CTest cases
+ would also lose their separate process, which is what several of them prove (exit status, hang, early close).
+
+## Left for later
+
+- Split `DeveloperBrowserIntegration` (59 to 113 s, the longest case and on the dependency chain) into independent cases.
+- `/analyze` in one job instead of every MSVC compilation (about 22 % of a Windows build; a policy decision).
+- The examples (`HelloWorld`, `LifeDeveloper`, `LifeReact`, 61 to 67 s each on MSVC) are built by every desktop job; building
+ them in one job per pull request would save about 190 s of compiler time per job.
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 9922fc2e..319cd881 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -2,6 +2,14 @@
## Unreleased
+- Cut pull-request CI time (#435): the desktop jobs build with `--parallel 4` and compile the 12 heavy unit-test files in
+ groups of four (`WEBFRONT_TEST_UNITY_BATCH`, `WEBFRONT_TEST_UNITY_HEAVY`; the default build keeps one object per file),
+ `JourneyEmbeddedBuild` and `LifeEmbeddedBuild` no longer hold the `webfront_port_9002` lock while they compile, and
+ `RunWithDeadline.sh` returns when its command does instead of at the deadline, which took 30 s from each of the six
+ `ConsumerJasmine-*` cases under dash. It also gives the command its own process group when the shell has no job
+ control. `WEBFRONT_MSVC_ANALYZE` (default ON) and `WEBFRONT_TEST_PCH` exist to measure `/analyze` and precompiled headers.
+ The `Build time study` workflow and `docs/BUILD_TIME_STUDY.md` hold the measurements and the decisions.
+
- Stabilise the desktop-native tier (#416): before removing its temporary WebView2 profile, the automation owner
waits up to 5 s for the browser processes it launched to exit and ends those still running (at once after a forced
exit, which also keeps the status of an exit that completes meanwhile), then retries files pending deletion for 2 s.
diff --git a/docs/TEST_PERFORMANCE.md b/docs/TEST_PERFORMANCE.md
index 494b5223..6329e9fa 100644
--- a/docs/TEST_PERFORMANCE.md
+++ b/docs/TEST_PERFORMANCE.md
@@ -172,3 +172,6 @@ compilation constraints before changing their coverage.
GCC parallel coverage relies on libgcov's filesystem locking; filesystems without locking require
isolated profiles and merging. macOS failures retain WebKit system/crash diagnostics and phase logs.
+
+Build-time measurements (compiler cache scenarios, grouping, precompiled headers, `/analyze`) and the decisions taken are in
+[BUILD_TIME_STUDY.md](BUILD_TIME_STUDY.md).
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index f483ba78..307433f7 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -48,13 +48,14 @@ if(MSVC)
endif()
target_compile_definitions(tests PRIVATE WEBFRONT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
-# Build-time study (#435), measurements only (docs/BUILD_TIME_STUDY.md): both knobs default to the regular build.
+# Build-time options (#435, docs/BUILD_TIME_STUDY.md). They default to one object per test file, which keeps rebuilds
+# fine-grained; the desktop CI jobs group the heavy units.
# WEBFRONT_TEST_UNITY_BATCH=N groups the translation units of `tests` by N (0: no unity build);
# WEBFRONT_TEST_UNITY_HEAVY=ON limits the grouping to the heavy units (those instantiating a full application);
-# WEBFRONT_TEST_PCH=ON precompiles the headers every test includes.
-set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "Study (#435): UNITY_BUILD_BATCH_SIZE of the tests target, 0 disables it")
-option(WEBFRONT_TEST_UNITY_HEAVY "Study (#435): group only the heavy translation units of the tests target" OFF)
-option(WEBFRONT_TEST_PCH "Study (#435): precompiled headers for the tests target" OFF)
+# WEBFRONT_TEST_PCH=ON precompiles the headers of the heavy units (measured, not adopted: sccache cannot cache it on MSVC).
+set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "UNITY_BUILD_BATCH_SIZE of the tests target, 0 disables it")
+option(WEBFRONT_TEST_UNITY_HEAVY "Group only the heavy translation units of the tests target" OFF)
+option(WEBFRONT_TEST_PCH "Precompiled headers for the heavy units of the tests target" OFF)
# The heavy units instantiate a full application; the others are light and keep the regular build.
set(_heavy WebFrontTests CommandsTests ApplicationTaskTests StdnetShutdownTests FrontendContractTests JsFunctionSenderTests
AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests)
From 6fce707515bfd8151731a7ee52a69bdaf79cd1cc Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 07:44:38 +0100
Subject: [PATCH 14/23] Add the measured pull-request run to the build-time
report [#435]
---
docs/BUILD_TIME_STUDY.md | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md
index 958aff73..bccdee1f 100644
--- a/docs/BUILD_TIME_STUDY.md
+++ b/docs/BUILD_TIME_STUDY.md
@@ -58,7 +58,7 @@ hosted runner. Adopted (`BuildAndTest.yml`, desktop jobs).
### Grouping the heavy units of `tests`
-`WEBFRONT_TEST_UNITY_BATCH=N` with `WEBFRONT_TEST_UNITY_HEAVY=ON` compiles the 12 heavy units of `tests` N to a file and
+`WEBFRONT_TEST_UNITY_BATCH=N` with `WEBFRONT_TEST_UNITY_HEAVY=ON` compiles the 13 heavy units of `tests` N to a file and
leaves the 140 light units alone. The `header`, `heavy-test` and `light-test` columns are the cost of a pull request that
changes `WebFront.hpp`, `WebFrontTests.cpp` or `MimeTypeTests.cpp` with a complete cache.
@@ -82,9 +82,9 @@ Linux (two runs, `-j4`):
Groups of 4 win on both compilers in every scenario: the unit of work stays small enough to spread over four jobs, and a
change to one heavy test recompiles at most three others. Groups of 12 put every heavy test behind one compilation, which is
slowest when one of them changes. Grouping every unit instead of the heavy ones does not compile (`GzipExecutorTests.cpp`,
-`DeveloperTests.cpp` and others define the same names); the heavy units needed four qualifications (`detail::` made
-ambiguous by `using namespace webfront`, a local alias that shadowed a file-scope one, and a header without
-`#pragma once`) and the whole suite passes. Adopted for the desktop CI jobs only (`BuildAndTest.yml`): the default build
+`DeveloperTests.cpp` and others define the same names); the heavy units needed five changes (`detail::` made
+ambiguous by `using namespace webfront`, a local alias that shadowed a file-scope one, two helpers of `BroadcastTests.cpp`
+named like those of `StdnetShutdownTests.cpp`, and a header without `#pragma once`) and the whole suite passes. Adopted for the desktop CI jobs only (`BuildAndTest.yml`): the default build
keeps one object per test file, and the portability and sanitizer jobs still compile each file alone, which would expose
a clash that grouping hides.
@@ -115,6 +115,21 @@ The analysis costs about 22 % of a Windows build. It is a quality gate (warnings
desktop job is a decision for the maintainers, not a build-time tweak. One way to keep the gate and the speed is to run it
in the portability job on pull requests into `master` only. **Not adopted; the option remains for measuring.**
+### The pull request that touches a core header
+
+The pull request's own run after merging `develop` (which changes `WebFront.hpp`, the situation of #400, #401 and #428), with
+the changes of this pull request in place (`-j4`, heavy units in groups of four), against run 41134609687 on the same kind of
+change:
+
+| | Linux | Windows |
+|---|---|---|
+| Build step | 328 s -> 85 s | 876 s -> 213 s |
+| Job | 12 min -> 6.8 min | about 20 min -> 7.7 min |
+
+A fully cached build takes 23 s (Linux) and 33 s (Windows) on this branch, so these builds did recompile the heavy units. The
+runs are single samples on runners that vary; the study tables above are the evidence, this is the check that they carry
+over to a real pull request.
+
### What the pull request gains
Test suite wall time on the pull request's own CI against run 41134609687 (same jobs, the compiler cache warm in both):
From e3ee1b7f1ddb65744682c016163a4f7e36c0a085 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 08:42:58 +0100
Subject: [PATCH 15/23] Record why the remaining items of the build-time study
are left [#435]
---
docs/BUILD_TIME_STUDY.md | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md
index bccdee1f..92353dd9 100644
--- a/docs/BUILD_TIME_STUDY.md
+++ b/docs/BUILD_TIME_STUDY.md
@@ -180,9 +180,31 @@ The suite takes 256 s on Linux and 271 s on Windows (run 41134609687). Measured
each instantiates its own frontend type, so a merged executable would still instantiate every type once. The CTest cases
would also lose their separate process, which is what several of them prove (exit status, hang, early close).
-## Left for later
+## What is left, and why it is not done
-- Split `DeveloperBrowserIntegration` (59 to 113 s, the longest case and on the dependency chain) into independent cases.
-- `/analyze` in one job instead of every MSVC compilation (about 22 % of a Windows build; a policy decision).
-- The examples (`HelloWorld`, `LifeDeveloper`, `LifeReact`, 61 to 67 s each on MSVC) are built by every desktop job; building
- them in one job per pull request would save about 190 s of compiler time per job.
+After these changes a desktop job spends its time as follows (run 41177164644, a pull request that touches a core header):
+
+| Step | Linux | Windows |
+|---|---|---|
+| Container start / checkout and CMake | 53 s | 23 s |
+| Configure | | 20 s |
+| Build | 85 s | 214 s |
+| Fast tests | 15 s | 17 s |
+| Test suite | 195 s | 163 s |
+| Coverage (Linux only) | 42 s | |
+
+The compiler-cache probe after the suite (a clean rebuild of `life_embedded`, `life_journey` and the consumer, run for #388) costs
+1 to 2 s, so it is not worth removing.
+
+- **`DeveloperBrowserIntegration`** (59 to 113 s) is the longest case and ends the dependency chain (`SelfBuildSession` ->
+ `DeveloperBrowserIntegration` -> `LifeEmbeddedBuild`). It is one 1,061-line script (`test/web/developer-specs.mjs`) run in one
+ browser over one project: later sections rely on the packages, lock and files the earlier ones installed (`terminal and sessions`
+ 32 s, `Life preview and bridge` 21 s, `Jasmine runs` 17 s, the TypeScript installs 12 + 8 s). Splitting it into parallel CTest
+ cases means giving each section its own project and setup, and it also produces the generated `LifeUI.hpp` that
+ `LifeEmbeddedBuild` compiles. That is a rewrite of the test, to be validated on all three frontends; it is not a build-time
+ tweak and was left alone.
+- **`/analyze`** and **the examples** (61 to 67 s each on MSVC) cost Windows compile time, but moving either to another job does
+ not shorten a pull request: a parallel job that compiles the same code takes as long, and the pull request waits for both.
+ Only dropping them from the pull-request path (`/analyze` into the `master` tier, the examples into one job) shortens it, and
+ that removes a check from every pull request into `develop`. The numbers are above (about 22 % of a Windows build for
+ `/analyze`, about 190 s of compiler time for the examples) so the maintainers can decide.
From 61e79765078f4aa65c7b89bdf6fbfc6a4fd6da03 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 08:52:58 +0100
Subject: [PATCH 16/23] Run the MSVC analysis and compile the examples in the
master and weekly tier only [#435]
---
.github/workflows/BuildAndTest.yml | 4 ++++
docs/BUILD_TIME_STUDY.md | 2 +-
docs/TEST_TIERS.md | 12 ++++++++++--
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml
index 2c657fd2..68ca066c 100644
--- a/.github/workflows/BuildAndTest.yml
+++ b/.github/workflows/BuildAndTest.yml
@@ -25,6 +25,9 @@ concurrency:
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
SCCACHE_GHA_ENABLED: 'true'
+ # The full tier of the desktop jobs (weekly, pull requests into and pushes to master, manual dispatch with repeat_desktop_tests)
+ # also runs the MSVC code analysis and compiles the examples; a pull request into develop does neither (#435, docs/BUILD_TIME_STUDY.md).
+ FULL_TIER: ${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_dispatch' && inputs.repeat_desktop_tests)) && 'true' || 'false' }}
# Third-party actions are pinned to commit SHAs; GitHub-owned actions/* use version tags.
jobs:
@@ -128,6 +131,7 @@ jobs:
-DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
-DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_UNITY_HEAVY=ON
+ ${{ env.FULL_TIER == 'true' && '' || '-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF' }}
${{ matrix.options }}
- name: Build
run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 4
diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md
index 92353dd9..150e57b4 100644
--- a/docs/BUILD_TIME_STUDY.md
+++ b/docs/BUILD_TIME_STUDY.md
@@ -113,7 +113,7 @@ its cost on `tests` with `-j4`:
The analysis costs about 22 % of a Windows build. It is a quality gate (warnings are errors), so removing it from the
desktop job is a decision for the maintainers, not a build-time tweak. One way to keep the gate and the speed is to run it
-in the portability job on pull requests into `master` only. **Not adopted; the option remains for measuring.**
+in the portability job on pull requests into `master` only. **Moved to the master tier** (see "What is left"); the option stays for measuring.
### The pull request that touches a core header
diff --git a/docs/TEST_TIERS.md b/docs/TEST_TIERS.md
index c22ec6a8..030a6ea6 100644
--- a/docs/TEST_TIERS.md
+++ b/docs/TEST_TIERS.md
@@ -38,13 +38,21 @@ spec expected the refusal. A wait is labelled `timeout (expected)` only for a ti
and `cancelled (expected)` only when the spec pressed Ctrl+C; any other time limit or cancellation appears as `timeout`
or `cancelled`. This trace comes from the specs (`test/web/developer-specs.mjs`), not from the published environment.
+## What the desktop jobs compile
+
+A pull request into `develop` builds the library, the tests and the test applications, with the MSVC code analysis (`/analyze`)
+off and without the examples (`WEBFRONT_MSVC_ANALYZE=OFF`, `WEBFRONT_BUILD_EXAMPLES=OFF`): about 22 % and 190 s of compiler
+time on Windows (docs/BUILD_TIME_STUDY.md). The advanced checks below turn both on again, so a warning that only the analysis
+reports, or an example that no longer compiles, is found by the weekly run, by the pull request into `master` or by a manual
+dispatch with `repeat_desktop_tests`, not by a pull request into `develop`. A local build has both by default.
+
## Advanced checks
These run on the weekly schedule (Monday 04:23 UTC), on every pull request whose base is `master`, and on a manual
dispatch with `repeat_desktop_tests`:
-- the complete desktop suite on the three desktop platforms, repeated three times with its fixtures reset on each pass,
- including the portability tests;
+- the complete desktop suite on the three desktop platforms, built with the MSVC code analysis and the examples, repeated
+ three times with its fixtures reset on each pass, including the portability tests;
- the `portability` job: the consumer project configured with Ninja (GCC on Linux, MSVC on Windows, Apple clang on macOS),
with Unix Makefiles (Clang 23) and, reported but never blocking until it has run on a hosted runner, the Visual Studio
2026 generator. There is no compiler cache: a new user compiles everything;
From 4a3efcce5a20340221e62d2f37dee2a3ab5234b1 Mon Sep 17 00:00:00 2001
From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com>
Date: Sat, 31 Oct 2026 08:59:17 +0100
Subject: [PATCH 17/23] Cut DeveloperBrowserIntegration into five parts that
run in parallel [#435]
---
docs/BUILD_TIME_STUDY.md | 28 +-
docs/CHANGELOG.md | 5 +-
docs/DEVELOPER_ENVIRONMENT.md | 2 +-
docs/TEST_PERFORMANCE.md | 2 +-
docs/TEST_TIERS.md | 9 +-
test/web/CMakeLists.txt | 20 +-
test/web/DeveloperTest.cpp | 56 +-
test/web/developer-specs.mjs | 1819 +++++++++++++++++----------------
8 files changed, 1015 insertions(+), 926 deletions(-)
diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md
index 150e57b4..2ca11490 100644
--- a/docs/BUILD_TIME_STUDY.md
+++ b/docs/BUILD_TIME_STUDY.md
@@ -180,9 +180,9 @@ The suite takes 256 s on Linux and 271 s on Windows (run 41134609687). Measured
each instantiates its own frontend type, so a merged executable would still instantiate every type once. The CTest cases
would also lose their separate process, which is what several of them prove (exit status, hang, early close).
-## What is left, and why it is not done
+## What was left after the first pass, and what was done about it
-After these changes a desktop job spends its time as follows (run 41177164644, a pull request that touches a core header):
+After the changes above a desktop job spends its time as follows (run 41177164644, a pull request that touches a core header):
| Step | Linux | Windows |
|---|---|---|
@@ -196,15 +196,15 @@ After these changes a desktop job spends its time as follows (run 41177164644, a
The compiler-cache probe after the suite (a clean rebuild of `life_embedded`, `life_journey` and the consumer, run for #388) costs
1 to 2 s, so it is not worth removing.
-- **`DeveloperBrowserIntegration`** (59 to 113 s) is the longest case and ends the dependency chain (`SelfBuildSession` ->
- `DeveloperBrowserIntegration` -> `LifeEmbeddedBuild`). It is one 1,061-line script (`test/web/developer-specs.mjs`) run in one
- browser over one project: later sections rely on the packages, lock and files the earlier ones installed (`terminal and sessions`
- 32 s, `Life preview and bridge` 21 s, `Jasmine runs` 17 s, the TypeScript installs 12 + 8 s). Splitting it into parallel CTest
- cases means giving each section its own project and setup, and it also produces the generated `LifeUI.hpp` that
- `LifeEmbeddedBuild` compiles. That is a rewrite of the test, to be validated on all three frontends; it is not a build-time
- tweak and was left alone.
-- **`/analyze`** and **the examples** (61 to 67 s each on MSVC) cost Windows compile time, but moving either to another job does
- not shorten a pull request: a parallel job that compiles the same code takes as long, and the pull request waits for both.
- Only dropping them from the pull-request path (`/analyze` into the `master` tier, the examples into one job) shortens it, and
- that removes a check from every pull request into `develop`. The numbers are above (about 22 % of a Windows build for
- `/analyze`, about 190 s of compiler time for the examples) so the maintainers can decide.
+- **`/analyze` and the examples** (about 22 % of a Windows build, and 61 to 67 s each on MSVC) moved to the master tier. Putting
+ them in a parallel job would not have shortened a pull request, which waits for both, so a pull request into `develop` no longer
+ builds either; the weekly run, a pull request into `master`, a push to `master` and a manual dispatch with
+ `repeat_desktop_tests` do (`FULL_TIER` in `BuildAndTest.yml`, `docs/TEST_TIERS.md`).
+- **`DeveloperBrowserIntegration`** (59 to 113 s, the longest case, at the end of the chain `SelfBuildSession` ->
+ `DeveloperBrowserIntegration` -> `LifeEmbeddedBuild`) was one 1,061-line script in one browser over one project. It is now
+ five parts, selected by `developer_integration --part=`: `app` (starter, build, `wf dev`, Life preview, embedding, and
+ the `LifeUI.hpp` that `LifeEmbeddedBuild` compiles), `scripts` (package commands, `wf run`, `wf exec`), `typescript`
+ (`wf check`), `jasmine` (`wf test`) and `terminal` (the terminal, sessions and history). Each part creates and initialises its
+ own project, installs what it needs and listens on a port the system picks, so none holds `webfront_port_9002`; with no
+ `--part` the executable plays them all in one session as before. Locally on macOS (WKWebView) the four cases other than `app`
+ take 3 to 6 s each once the environment is built.
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 5d06c97b..8d9fbc02 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,7 +8,10 @@
`RunWithDeadline.sh` returns when its command does instead of at the deadline, which took 30 s from each of the six
`ConsumerJasmine-*` cases under dash. It also gives the command its own process group when the shell has no job
control. `WEBFRONT_MSVC_ANALYZE` (default ON) and `WEBFRONT_TEST_PCH` exist to measure `/analyze` and precompiled headers.
- The `Build time study` workflow and `docs/BUILD_TIME_STUDY.md` hold the measurements and the decisions.
+ The `Build time study` workflow and `docs/BUILD_TIME_STUDY.md` hold the measurements and the decisions. The
+ MSVC code analysis and the examples are built by the master and weekly tier only, and `DeveloperBrowserIntegration`
+ is cut into five parts (`DeveloperBrowserIntegration`, `-scripts`, `-typescript`, `-jasmine`, `-terminal`) that
+ run in parallel from their own projects on ephemeral ports.
- Reject a stale `UI` after its connection identifier is reused (#428): each connection gets a 64-bit
generation, never reused, kept in the application next to its link. `UI`, `JsFunction` and
diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md
index 89718ee6..bd26b085 100644
--- a/docs/DEVELOPER_ENVIRONMENT.md
+++ b/docs/DEVELOPER_ENVIRONMENT.md
@@ -678,7 +678,7 @@ WKWebView and all 14 Linux CEF/Xvfb cases with both GCC and Clang in
The packed 0.3.0 version passes WKWebView and all 14 GCC CEF/Xvfb cases in
[run 39490581423](https://github.com/ambroise-leclerc/WebFront/actions/runs/39490581423).
For Linux, select CEF and Xvfb instead; the same developer tests use the selected test frontend.
-`DeveloperBrowserIntegration` exercises the real WASM compiler, local registry, `wf test` under the locked jasmine-core (pass, fail, pending, asynchronous failures, pattern, time limit, Ctrl+C, non-interactive report to C++), build without navigation, incremental dev reload/error/recovery/Ctrl+C, the Life preview, C++ generation/animation and repeatable header generation. Its CTest fixtures then build that
+`DeveloperBrowserIntegration` (the application part: starter, build, `wf dev`, Life preview, embedding) and `DeveloperBrowserIntegration-scripts`, `-typescript`, `-jasmine` and `-terminal` exercise, in parallel and each from its own project, the real WASM compiler, local registry, `wf test` under the locked jasmine-core (pass, fail, pending, asynchronous failures, pattern, time limit, Ctrl+C, non-interactive report to C++), build without navigation, incremental dev reload/error/recovery/Ctrl+C, the Life preview, C++ generation/animation and repeatable header generation. Its CTest fixtures then build that
**browser-generated** header and run `LifeEmbeddedIntegration` from an empty working directory
with no developer callbacks.
Deadline and grace-period regressions advance a scoped clock instead of sleeping for seconds; Worker startup,
diff --git a/docs/TEST_PERFORMANCE.md b/docs/TEST_PERFORMANCE.md
index 6329e9fa..de57d04b 100644
--- a/docs/TEST_PERFORMANCE.md
+++ b/docs/TEST_PERFORMANCE.md
@@ -120,7 +120,7 @@ sampled bounds, not precise unique-memory or process-creation counts. Pre-existi
sccache server and its compiler children can fall outside this process family; sccache's own statistics complement the
sampled build report. It preserves the measured command's failure status.
-`DeveloperBrowserIntegration` emits begin/end timestamps for each major phase and every actual command, including
+`DeveloperBrowserIntegration` and its four sibling parts emit begin/end timestamps for each major phase and every actual command, including
expected failures. `DeveloperSpecs` reports both ends of each spec. The driver reports browser opening/return and shutdown,
and every suite case, so process-exit costs remain distinguishable. `LastTest-.log` keeps the full transcript of each pass; the suite
runner raises the CTest output cap to 2 MiB per case so JUnit retains these details too. The analyzer ranks the emitted
diff --git a/docs/TEST_TIERS.md b/docs/TEST_TIERS.md
index 030a6ea6..61f47d39 100644
--- a/docs/TEST_TIERS.md
+++ b/docs/TEST_TIERS.md
@@ -21,7 +21,8 @@ cmake -DBUILD_DIR=build -DLABEL_EXCLUDE=portability -P test/cmake/RunTestSuite.c
## Following a browser test live
-`DeveloperBrowserIntegration`, the `Automation*` cases and the `WfDriver*` cases run `wf` commands (`create`, `install`,
+`DeveloperBrowserIntegration` and its siblings `DeveloperBrowserIntegration-scripts`, `-typescript`, `-jasmine` and `-terminal`
+(the parts of `test/web/developer-specs.mjs`, which run in parallel on a port the system picks), the `Automation*` cases and the `WfDriver*` cases run `wf` commands (`create`, `install`,
`build`, `dev`, `preview`, `embed`, ...) that can take several seconds each. CTest hides the output of a passing test, so
to watch one:
@@ -30,6 +31,12 @@ ctest --test-dir build -R DeveloperBrowserIntegration -V # CTest prints t
ctest --test-dir build -R DeveloperBrowserIntegration -N -V # prints the command to run `developer_integration` directly
```
+Run `developer_integration` with a fixtures directory and an output directory but no `--part=` to play every part in one
+session, as the test did before it was cut; `--part=app|scripts|typescript|jasmine|terminal` plays one.
+
+```bash
+```
+
The process prints a `Developer integration: