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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/wf-driver/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:
shell: bash
run: |
cmake -S . -B build-driver -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON \
-DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK \
-DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK -DWEBFRONT_TEST_REPRODUCIBILITY=ON \
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
cmake --build build-driver --target webfront-wf --parallel 2
- name: Install the wf command
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ jobs:
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.
# No job relies on a default of the test options: the defaults are those of a quick local build (docs/TEST_TIERS.md).
# The unit tests run as four Catch2 shards instead of one process per scenario (docs/TEST_TIERS.md).
- name: Configure
run: >-
Expand All @@ -155,7 +156,7 @@ jobs:
-DWEBFRONT_TEST_UNITY_BATCH=4
-DWEBFRONT_TEST_UNIT_SHARDS=4
-DWEBFRONT_TEST_REPRODUCIBILITY=${{ env.WEBFRONT_REPRODUCIBILITY }}
${{ env.FULL_TIER == 'true' && '' || '-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF' }}
${{ env.FULL_TIER == 'true' && '-DWEBFRONT_MSVC_ANALYZE=ON -DWEBFRONT_BUILD_EXAMPLES=ON' || '-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
Expand Down Expand Up @@ -370,7 +371,7 @@ jobs:
# No compiler cache: a new user compiles everything.
- name: Configure
shell: bash
run: cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_SCAN_FOR_MODULES=OFF
run: cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_SCAN_FOR_MODULES=OFF -DWEBFRONT_TEST_UNITY_BATCH=0 -DWEBFRONT_MSVC_ANALYZE=ON -DWEBFRONT_TEST_REPRODUCIBILITY=ON
- name: Portability tests
shell: bash
run: ctest --test-dir build -C Release -L portability --output-on-failure --no-tests=error
Expand Down Expand Up @@ -489,6 +490,7 @@ jobs:
cmake -S . -B build-sanitizers -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF
-DWEBFRONT_TEST_UNITY_BATCH=0 -DWEBFRONT_TEST_REPRODUCIBILITY=ON
${{ matrix.sanitizer == 'thread' && '-DCMAKE_CXX_FLAGS=-stdlib=libc++ -DWEBFRONT_ENABLE_SANITIZER_THREAD=ON' || '-DWEBFRONT_ENABLE_SANITIZER_ADDRESS=ON -DWEBFRONT_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON -DWEBFRONT_ENABLE_FUZZING=ON -DWEBFRONT_GZIP_DIFFERENTIAL=ON' }}
- name: Build
run: cmake --build build-sanitizers --parallel 2
Expand Down Expand Up @@ -571,7 +573,7 @@ jobs:

# The registry packages and the pinned bootstrap environment are downloaded and verified here; wf then builds the rest.
- name: Configure CEF integration build
run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF
run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DWEBFRONT_TEST_REPRODUCIBILITY=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF

- name: Build browser test
run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration webfront-wf --parallel 2
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ without network access.
- `WEBFRONT_ENABLE_TESTING=ON` (default `OFF`): build Catch2 and Jasmine test targets. CI and contributor commands must pass it explicitly. The test, fuzzing, coverage and sanitizer options (`WEBFRONT_ENABLE_SANITIZER_*`) carry the `WEBFRONT_` prefix so that a parent's own `ENABLE_TESTING` or `ENABLE_SANITIZER_ADDRESS` never builds or instruments WebFront's tests; the former unprefixed names no longer configure WebFront (`cmake/WebFrontTestOptions.cmake` documents the options).
- `WEBFRONT_BUILD_EXAMPLES` (default `ON` only for the top-level project): build the examples. As a subproject (`add_subdirectory`), link `WebFront::WebFront`; no examples, tests or global compiler settings are added.
- `WEBFRONT_ENABLE_COVERAGE=ON`: add GCC/Clang coverage instrumentation to the C++ tests.
- The project has no CMake presets: the defaults are the quick local build (`WEBFRONT_TEST_UNITY_BATCH=4`, `WEBFRONT_MSVC_ANALYZE=OFF`, `WEBFRONT_TEST_REPRODUCIBILITY=OFF`) and every CI job passes these options explicitly (`docs/TEST_TIERS.md`).

If the environment provides a read-only default ccache directory, set `CCACHE_DIR` to a writable temporary directory for local builds. Do not encode machine-specific cache paths in project files. In CI, `ENABLE_CACHE=OFF` disables automatic cache discovery while `CMAKE_CXX_COMPILER_LAUNCHER=sccache` explicitly enables sccache; a PATH/version probe runs on all three platforms. The combined Linux job uses Debug with GCC coverage on every PR; Windows and macOS use Release. The WebKitGTK sandbox opt-out is confined to the Linux test step and trusted fixtures.

Expand Down
4 changes: 2 additions & 2 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +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)
# MSVC /analyze roughly doubles the front-end work of every unit (#435): a local build leaves it out, and the
# advanced CI tier turns it on (docs/TEST_TIERS.md).

set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
Expand Down
4 changes: 4 additions & 0 deletions cmake/WebFrontTestOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# WebFront options are independent of an embedding project's generic ENABLE_* variables.
function(webfront_declare_test_options is_top_level)
# Keep the quick-build defaults here so the lightweight configuration fixture tests the actual declarations.
set(WEBFRONT_TEST_UNITY_BATCH 4 CACHE STRING "Compile the heavy unit tests this many to a file; 0 compiles each file alone")
option(WEBFRONT_MSVC_ANALYZE "Run the MSVC code analysis while compiling" OFF)
option(WEBFRONT_TEST_REPRODUCIBILITY "Build the self-built environment again, to prove it reproducible and equal to the checked-in bundles" OFF)
option(WEBFRONT_ENABLE_TESTING "Build WebFront's tests" OFF)
option(WEBFRONT_ENABLE_FUZZING "Build WebFront's fuzzers" OFF)
option(WEBFRONT_ENABLE_COVERAGE "Instrument WebFront's tests for GCC/Clang coverage" OFF)
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD_TIME_STUDY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs; Linux runs are steadier.
| Change | Effect |
|---|---|
| `--parallel 4` on the desktop builds | Linux `tests` 280 -> 170 s cold, `all` 520 -> 255-375 s; Windows `tests` 820 -> 640 s, `all` 1240 -> 1080 s. Peak memory stays under 1 GB. |
| The 13 heavy unit tests compile four to a file (`WEBFRONT_TEST_UNITY_BATCH=4` on the desktop jobs) | Windows cold 640 -> 355 s, `WebFront.hpp` changed 298 -> 111 s; Linux 202 -> 143 s and 88 -> 45 s. Less memory. |
| The 13 heavy unit tests compile four to a file (`WEBFRONT_TEST_UNITY_BATCH=4`, the default) | Windows cold 640 -> 355 s, `WebFront.hpp` changed 298 -> 111 s; Linux 202 -> 143 s and 88 -> 45 s. Less memory. |
| MSVC `/analyze` and the examples only in the master and weekly tier | `/analyze` is about 22 % of a Windows build (640 -> 497 s cold); the examples about 190 s of compiler time. |
| The reproducibility builds only when a pull request changes their inputs | About 45 s of worker time per job (`SelfBuildRepeat`, `SelfBuildRefresh`). |
| `JourneyEmbeddedBuild` and `LifeEmbeddedBuild` do not hold `webfront_port_9002` | They only compile; the lock had serialised 175 s (Linux) and 203 s (Windows) of tests. |
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ these entries stays in the GitHub releases and the Git history.
- Declare GCC 13 as the best-effort S2 minimum for the library and examples, document the GCC 14 exit clause and qualified Clang scope, and add GCC 13 ASan/UBSan fast tests (#525, ADR-022).

- Open the developer page on the interface, over the whole window, once the project has a preview; the terminal moves to a floating, movable window behind a tab on the right edge that shows the session's state, and keeps its session when collapsed. Its shortcut is F9, or the manifest's new optional `developer.terminalShortcut`. Environment sources 0.9.1, not published yet (#539, `docs/DEVELOPER_ENVIRONMENT.md`).
- Make the default test build the quick one: the heavy unit tests compile four to a file, the MSVC code analysis and the reproducibility proofs are off unless `-DWEBFRONT_MSVC_ANALYZE=ON` or `-DWEBFRONT_TEST_REPRODUCIBILITY=ON` asks for them. The CI passes every option explicitly and checks what it checked before (#546).
- Run the unit tests as a few processes instead of one per scenario with `-DWEBFRONT_TEST_UNIT_SHARDS=<n>`: each of the `n` CTest cases is a Catch2 shard that reports every scenario in `unit-results-<shard>.xml`. The default still registers one CTest case per scenario; the desktop CI jobs pass 4 and no longer run the fast tier twice on a pull request (#543).

### Fixed
Expand Down
13 changes: 11 additions & 2 deletions docs/TEST_TIERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,29 @@ 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.

## A quick local build by default

The defaults of the test options are those of the quickest useful build, and the project has no CMake preset to choose
between: `-DWEBFRONT_ENABLE_TESTING=ON` alone compiles the heavy unit tests four to a file
(`WEBFRONT_TEST_UNITY_BATCH=4`), leaves the MSVC code analysis out (`WEBFRONT_MSVC_ANALYZE=OFF`) and does not register
the reproducibility proofs (`WEBFRONT_TEST_REPRODUCIBILITY=OFF`). The CI passes every one of these options explicitly,
so a default can change without changing what a job checks. While working, `ctest -L fast` then the cases the change
touches (`ctest -R <name>`) are enough; the complete suite runs before the work is declared complete.

## 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.
dispatch with `repeat_desktop_tests`, not by a pull request into `develop`.

The proofs that the self-built environment is reproducible and equal to the checked-in bundles (`SelfBuildRepeat`,
`SelfBuildReproducible`, `SelfBuildRefresh`, `SelfBuildRefreshMatchesSources`) build it twice more, about 45 s on a hosted
runner. A pull request into `develop` runs them only when it changes one of their inputs (`js/`, `examples/life/ui/`,
`test/developer/`, `test/web/registry/` and `test/web/CMakeLists.txt`, `include/webfront/system/`, the CMake scripts that
prepare, compare and assemble the self-build project, `LICENSE` and the workflow itself); a push to `develop` and the advanced
checks always run them. `-DWEBFRONT_TEST_REPRODUCIBILITY=OFF` leaves them out locally; the default is ON.
checks always run them. They are off by default: `-DWEBFRONT_TEST_REPRODUCIBILITY=ON` adds them to a local build.

## Advanced checks

Expand Down
5 changes: 4 additions & 1 deletion test/cmake/CheckTestOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function(configure name directory)
endforeach()
endfunction()
configure("defaults" defaults OPTIONS -DTOP_LEVEL=ON
EXPECT "TESTING=OFF LEGACY=<unset>" "FUZZING=OFF LEGACY=<unset>" "COVERAGE=OFF LEGACY=<unset>")
EXPECT "TESTING=OFF LEGACY=<unset>" "FUZZING=OFF LEGACY=<unset>" "COVERAGE=OFF LEGACY=<unset>"
"TEST_UNITY_BATCH=4" "MSVC_ANALYZE=OFF" "TEST_REPRODUCIBILITY=OFF")
foreach(level ON OFF)
configure("generic options at level ${level}" "generic-${level}"
OPTIONS -DTOP_LEVEL=${level} -DENABLE_TESTING=ON -DENABLE_FUZZING=ON -DENABLE_COVERAGE=ON
Expand All @@ -31,10 +32,12 @@ foreach(level ON OFF)
"SANITIZER_MEMORY=OFF LEGACY=ON")
configure("explicit options at level ${level}" "generic-${level}"
OPTIONS -DWEBFRONT_ENABLE_TESTING=ON -DWEBFRONT_ENABLE_FUZZING=ON -DWEBFRONT_ENABLE_COVERAGE=ON
-DWEBFRONT_TEST_UNITY_BATCH=0 -DWEBFRONT_MSVC_ANALYZE=ON -DWEBFRONT_TEST_REPRODUCIBILITY=ON
-DWEBFRONT_ENABLE_SANITIZER_ADDRESS=ON -DWEBFRONT_ENABLE_SANITIZER_LEAK=ON
-DWEBFRONT_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON -DWEBFRONT_ENABLE_SANITIZER_THREAD=ON
-DWEBFRONT_ENABLE_SANITIZER_MEMORY=ON
EXPECT "TESTING=ON LEGACY=ON" "FUZZING=ON LEGACY=ON" "COVERAGE=ON LEGACY=ON"
"TEST_UNITY_BATCH=0" "MSVC_ANALYZE=ON" "TEST_REPRODUCIBILITY=ON"
"SANITIZER_ADDRESS=ON LEGACY=ON" "SANITIZER_LEAK=ON LEGACY=ON"
"SANITIZER_UNDEFINED_BEHAVIOR=ON LEGACY=ON" "SANITIZER_THREAD=ON LEGACY=ON"
"SANITIZER_MEMORY=ON LEGACY=ON")
Expand Down
3 changes: 3 additions & 0 deletions test/cmake/test-options/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ endif()
# As in the root CMakeLists.txt, after project(), which reads CMAKE_TOOLCHAIN_FILE (test-options/Toolchain.cmake).
include("${ROOT}/cmake/WebFrontTestOptions.cmake")
webfront_declare_test_options(${TOP_LEVEL})
foreach(name TEST_UNITY_BATCH MSVC_ANALYZE TEST_REPRODUCIBILITY)
message(STATUS "${name}=${WEBFRONT_${name}}")
endforeach()
foreach(name TESTING FUZZING COVERAGE SANITIZER_ADDRESS SANITIZER_LEAK SANITIZER_UNDEFINED_BEHAVIOR
SANITIZER_THREAD SANITIZER_MEMORY)
if(DEFINED CACHE{ENABLE_${name}})
Expand Down
5 changes: 2 additions & 3 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ add_dependencies(tests host_probe)
target_compile_definitions(tests PRIVATE WEBFRONT_HOST_PROBE="$<TARGET_FILE:host_probe>")

# The heavy units instantiate a full application, and compile four to a file in about half the time of four apart
# (docs/BUILD_TIME_STUDY.md). The desktop CI jobs set the batch size; the default keeps one object per test file, which
# keeps a rebuild after one edit small. The light units stay apart: grouping every unit does not compile, as their
# (docs/BUILD_TIME_STUDY.md): that is the default. 0 keeps one object per test file, which the portability and
# sanitizer jobs ask for. The light units stay apart: grouping every unit does not compile, as their
# helpers share names.
set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "Compile the heavy unit tests this many to a file; 0 compiles each file alone")
if(WEBFRONT_TEST_UNITY_BATCH GREATER 0)
set(_heavy WebFrontTests ReadBindingTests ViewAssociationTests BroadcastTests CommandsTests ApplicationTaskTests DeferredCallTests StdnetShutdownTests FrontendContractTests JsFunctionSenderTests
AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests)
Expand Down
4 changes: 2 additions & 2 deletions test/web/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ if(_browser_tests_available)
webfront_add_self_build_test(DeveloperSpecs 0 "test|--timeout|240" OUTPUT "PASSED: [0-9]+ specs" TIMEOUT 300
REQUIRES SelfBuildInstalled)
# The reproducibility proofs build the environment again, the second time from a refreshed bootstrap: about 45 s on a
# hosted runner. A pull request that changes none of their inputs may leave them to the master tier (#435).
option(WEBFRONT_TEST_REPRODUCIBILITY "Build the self-built environment again, to prove it reproducible and equal to the checked-in bundles" ON)
# hosted runner. A pull request that changes none of their inputs may leave them to the master tier (#435), and a
# local build leaves them out unless it asks for them.
if(WEBFRONT_TEST_REPRODUCIBILITY)
webfront_add_self_build_test(SelfBuildRepeat 0 "run|build|build-distribution-repeat" OUTPUT "Script build completed"
REQUIRES SelfBuilt PROVIDES SelfBuiltTwice)
Expand Down
Loading