Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0d0cac1
Catch2 comes from vcpkg when the tests are built
RyeMutt Oct 9, 2026
6c94365
The Catch2 harness: a main, LL_ERRS as an exception, LOGFAIL, a state…
RyeMutt Oct 9, 2026
2c39ac2
al_add_test_binary builds many Catch2 test files into one binary and …
RyeMutt Oct 9, 2026
218402e
The Catch2 harness tests itself
RyeMutt Oct 9, 2026
1ac2e23
Catch2 comes from alchemy-registry, at 3.16.1
RyeMutt Oct 9, 2026
6613281
The Catch2 harness names the running test case, names the failure it …
RyeMutt Oct 9, 2026
cfd2172
tut2catch.py converts TUT test files to idiomatic Catch2, deciding ea…
RyeMutt Oct 9, 2026
ebb18dc
tut_parity.py proves a converted test file runs the same tests to the…
RyeMutt Oct 9, 2026
e0a6e4e
The test harness's state guard may read the FP control register
RyeMutt Oct 9, 2026
08a02a5
An ISA tier's test binary may share its files, and skips below the tr…
RyeMutt Oct 9, 2026
40f4ffe
CI runs the Catch2 binaries' pending combined runs, and reports them …
RyeMutt Oct 9, 2026
8df7940
tut2catch.py writes Catch2 that reports every failure and prints what…
RyeMutt Oct 11, 2026
92f8c42
The Catch2 harness prints every digit of a float
RyeMutt Oct 11, 2026
9a3d0d1
llmath's tests are Catch2, in one binary
RyeMutt Oct 11, 2026
bae1eeb
llmath's tests read as Catch2 a person would write
RyeMutt Oct 11, 2026
61c6507
The harness's own test names no variable near, which windows.h define…
RyeMutt Oct 11, 2026
c44e889
The default test run leaves out one label, manual, which benchmarks a…
RyeMutt Oct 11, 2026
4c06fdf
AL_TEST_PER_CASE configures, and its cases carry what a file's entry …
RyeMutt Oct 11, 2026
a88d588
A per-case entry whose name has brackets gets its properties too
RyeMutt Oct 11, 2026
03e47a7
The Catch2 harness has ensure_distance's strict matcher, WithinDistance
RyeMutt Oct 11, 2026
f5a9d12
The Catch2 harness fails every run that ends badly, and says what end…
RyeMutt Oct 11, 2026
77cb2df
al_add_test_binary passes the ISA level as one argument, and fails a …
RyeMutt Oct 11, 2026
9fe76d9
CI keeps the build's test log and the combined run's JUnit, and the d…
RyeMutt Oct 11, 2026
68d7ff6
mathmisc's cases run in TUT's order, and llmatrix4a stops where TUT s…
RyeMutt Oct 11, 2026
3f32f5d
tut_parity.py takes TUT's result for a test only from the entry that …
RyeMutt Oct 11, 2026
2634d9d
tut_parity.py holds a run's cases one by one, and its exit code to them
RyeMutt Oct 11, 2026
3f448df
tut_parity.py holds the cases to the order TUT ran their tests in
RyeMutt Oct 11, 2026
c1a6e97
tut_parity.py holds every assertion in a passing case to having run
RyeMutt Oct 11, 2026
7405bf9
tut_parity.py --recounted still fails a case left with no assertion
RyeMutt Oct 11, 2026
945ef28
tut_parity.py holds the assertions outside every case to the mapping'…
RyeMutt Oct 11, 2026
faf9451
tut_parity.py refuses inputs that are not of the run it checks
RyeMutt Oct 11, 2026
cabb20b
tut_parity.py checks a file built at several ISA tiers a tier at a time
RyeMutt Oct 12, 2026
5fb4ffa
tut_parity.py counts a case's assertions in the body that ran
RyeMutt Oct 12, 2026
4cbc335
tut_parity.py holds to having run only the assertions this build comp…
RyeMutt Oct 12, 2026
347a3b3
tut_parity.py reads the harness's exit 1 as it now means
RyeMutt Oct 12, 2026
8aa8a73
tut2catch.py records a file its own bug stopped, traceback and all, a…
RyeMutt Oct 11, 2026
7ec8a26
tut2catch.py finds the tut:: types production code befriends with a l…
RyeMutt Oct 11, 2026
4144cf9
tut2catch.py gives two cases one name only where one #if's branches p…
RyeMutt Oct 11, 2026
e14ace1
tut2catch.py keeps a class derived from test_group that holds more th…
RyeMutt Oct 11, 2026
a93039a
tut2catch.py splits and rewrites a condition only where the test wrot…
RyeMutt Oct 12, 2026
81dc09c
tut2catch.py makes REQUIRE every guard a regression would crash past,…
RyeMutt Oct 12, 2026
1292358
tut2catch.py declares a file's cases in the order TUT ran them, group…
RyeMutt Oct 12, 2026
18d71ed
tut2catch.py writes ensure_distance as WithinDistance, in TUT's type …
RyeMutt Oct 12, 2026
5cf16c3
tut2catch.py compares two string literals strcmp compared as a string…
RyeMutt Oct 12, 2026
3ba8f47
tut2catch.py's mapping holds each file's TUT hash and the assertions …
RyeMutt Oct 12, 2026
34b9eac
tut2catch.py ends a case at a chain's term only where a later term le…
RyeMutt Oct 12, 2026
d434b89
tut2catch.py ends a case at a call that makes state only where that s…
RyeMutt Oct 12, 2026
3c3ea5f
tut2catch.py moves a test into a later block of its namespace, where …
RyeMutt Oct 12, 2026
b5b244c
tut2catch.py narrows ensure_approximately_equals_range's expected and…
RyeMutt Oct 12, 2026
054acab
tut2catch.py's mapping holds the sha256 of each Catch2 file it wrote
RyeMutt Oct 12, 2026
860deb9
tut2catch.py leaves a && chain whole where a later term changes somet…
RyeMutt Oct 12, 2026
bf34f38
tut2catch.py takes a member for a size only where it answers with a b…
RyeMutt Oct 12, 2026
17a46c7
tut_parity.py refuses a file edited since conversion unless --recount…
RyeMutt Oct 12, 2026
df2000b
CI runs the pending combined tests side by side, inside a step limit …
RyeMutt Oct 12, 2026
b1e6aae
On Windows the Catch2 harness names the case an abort from any thread…
RyeMutt Oct 12, 2026
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
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,39 @@ jobs:
esac
fi

# Each Catch2 binary's run of all its tests in one process, while it is
# still combined_pending: the default run leaves those out until they
# are known to share a process, and this is where that is learned, on
# every row. It reports, and never fails the job. The runs go side by
# side, so the step takes about as long as the longest, which CTest
# stops at an hour; the step's own limit is past that, so a hang is
# recorded as CTest's timeout and reaches the JUnit report.
- name: Run pending combined tests
if: ${{ !cancelled() && matrix.build_variant == 'Tests' }}
continue-on-error: true
timeout-minutes: 75
shell: bash
env:
BUILD_DIRECTORY: ${{ steps.configure.outputs.build_directory }}
run: |
case "$BUILD_CONFIG" in
release) cmake_config=Release ;;
relwithdebinfo) cmake_config=RelWithDebInfo ;;
optdebug) cmake_config=OptDebug ;;
*) cmake_config=Debug ;;
esac
# This run writes LastTest.log over the build's; the build's is kept
# under a name the upload below still takes.
log="$BUILD_DIRECTORY/Testing/Temporary/LastTest.log"
if [[ -f "$log" ]]; then
cp "$log" "$BUILD_DIRECTORY/Testing/Temporary/LastTest-build.log"
fi
jobs="$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)"
# CTest reads a relative --output-junit from the test directory.
ctest --test-dir "$BUILD_DIRECTORY" -C "$cmake_config" -L combined_pending \
--parallel "$jobs" --output-on-failure --no-tests=ignore \
--output-junit Testing/combined-pending-results.xml

# What each test did, on a row whose tests failed as much as on one
# whose tests passed: the JUnit file CTest writes and its own log. The
# build step's artifact name is unset when a test fails, so this one
Expand All @@ -525,6 +558,7 @@ jobs:
name: "test-results-${{ runner.os }}-${{ matrix.arch }}"
path: |
${{ steps.configure.outputs.build_directory }}/Testing/test-results.xml
${{ steps.configure.outputs.build_directory }}/Testing/combined-pending-results.xml
${{ steps.configure.outputs.build_directory }}/Testing/Temporary/LastTest*.log
if-no-files-found: warn

Expand Down
6 changes: 4 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ The viewer executable lands at `build-<OS>-<preset>/newview/<CONFIG>/` (e.g., `S
Tests are off by default. To enable: add `-DAL_BUILD_TESTS=ON` to the configure command. Then run via CTest:

```
ctest --test-dir build-<OS>-<preset> --output-on-failure
ctest --test-dir build-<OS>-<preset> --output-on-failure -LE manual
```

Unit tests live alongside the library they test in `indra/<library>/tests/` directories. The test framework is TUT (Template Unit Test). Test targets are defined by the `LL_ADD_PROJECT_UNIT_TESTS` macro in `indra/cmake/LLAddBuildTest.cmake`. Integration tests are in `indra/integration_tests/`.
`-LE manual` leaves out the benchmarks and the pending one-process runs of Catch2 binaries (label `combined_pending`), as the build's own test target does.

Unit tests live alongside the library they test in `indra/<library>/tests/` directories. They are moving from TUT (Template Unit Test) to Catch2 a library at a time. TUT test targets are defined by the `LL_ADD_PROJECT_UNIT_TESTS` macro in `indra/cmake/LLAddBuildTest.cmake`; a converted library builds its files into one Catch2 binary with `al_add_test_binary` (`indra/cmake/ALAddTestBinary.cmake`), on the harness in `indra/test/`. Integration tests are in `indra/integration_tests/`.

## Architecture

Expand Down
6 changes: 4 additions & 2 deletions doc/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,12 @@ Build, then run with CTest:

```
cmake --build <build-dir> --config RelWithDebInfo
ctest --test-dir <build-dir> --output-on-failure
ctest --test-dir <build-dir> --output-on-failure -LE manual
```

Unit tests live alongside the library they cover in `indra/<library>/tests/`, written against the TUT (Template Unit Test) framework. Integration tests are in `indra/integration_tests/`.
`-LE manual` leaves out what the build's own test target leaves out: the benchmarks, and each Catch2 binary's run of all its files in one process while that run is still labelled `combined_pending` (`ctest -L combined_pending` runs those).

Unit tests live alongside the library they cover in `indra/<library>/tests/`. They are moving from the TUT (Template Unit Test) framework to Catch2 a library at a time: a converted library builds its test files into one binary (`al_add_test_binary`, `indra/cmake/ALAddTestBinary.cmake`), each file still a CTest entry of its own, on the harness in `indra/test/`. Integration tests are in `indra/integration_tests/`.

## Editing XUI

Expand Down
23 changes: 19 additions & 4 deletions indra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ cmake_dependent_option(
"AL_BUILD_TESTS"
OFF
)
cmake_dependent_option(
AL_TEST_PER_CASE
"Register a Catch2 binary's test cases one CTest entry each, found when ctest runs, in place of one entry a test file: for finding a failure that comes from order or shared state"
OFF
"AL_BUILD_TESTS"
OFF
)
option(AL_BUILD_SHARED_LLCOMMON "Build llcommon as a shared library" OFF)
option(AL_BUILD_PACKAGE "Add the package target: the CPack archive of the installed tree" ON)

Expand Down Expand Up @@ -291,6 +298,10 @@ endif()
# vcpkg feature flags MUST be set before the first project() call below #
##########################################################################

if(AL_BUILD_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif()

if(AL_USE_KDU)
list(APPEND VCPKG_MANIFEST_FEATURES "kdu")
endif()
Expand Down Expand Up @@ -406,16 +417,19 @@ if(AL_BUILD_TESTS)
include(ProcessorCount)
ProcessorCount(NUM_CORES)

# Set parallel level to decrease test runtime. Benchmarks are registered
# as tests under their own label and left out of the default run, since
# their numbers are their output and a shared parallel run would ruin them.
# Set parallel level to decrease test runtime. What is labelled manual runs
# only when asked for by its own label: benchmarks, since their numbers are
# their output and a shared parallel run would ruin them, and a Catch2
# binary's run of all its tests in one process until they are known to
# share one (combined_pending; see ALAddTestBinary.cmake). One label, since
# these arguments reach a shell, which would take a | in a regex for a pipe.
# Each run also writes its results as JUnit, which CI keeps.
set(
CMAKE_CTEST_ARGUMENTS
-j${NUM_CORES}
--output-on-failure
-LE
benchmark
manual
--output-junit
"${CMAKE_BINARY_DIR}/Testing/test-results.xml"
)
Expand Down Expand Up @@ -477,6 +491,7 @@ endforeach()
# Add our test macros
if(AL_BUILD_TESTS)
include(LLAddBuildTest)
include(ALAddTestBinary)
endif()

# The build system's own files, for the IDE.
Expand Down
Loading
Loading