test: support running functionaltests in parallel by directory (#37918)

Define a CMake target for every subdirectory of test/functional that
contains functional tests, and a functionaltest_parallel target that
depends on all those targets, allowing multiple test runners to run in
parallel.

On CI, use at most 2 parallel test runners, as using more may increase
system load and make tests unstable.
This commit is contained in:
zeertzjq
2026-02-18 15:56:50 +08:00
committed by GitHub
parent 9492df027d
commit 496eca22b3
13 changed files with 206 additions and 102 deletions

View File

@@ -163,16 +163,29 @@ jobs:
cmake --preset ci -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.build.flags }}
cmake --build build
- if: ${{ matrix.test == 'unittest' }}
name: unittest
timeout-minutes: 20
run: cmake --build build --target unittest
- if: ${{ matrix.test == 'functionaltest' }}
name: functionaltest
timeout-minutes: 20
env:
# With parallel tests, use shorter timeout for a single group.
TEST_TIMEOUT: 600
run: |
set +e
cmake --build build --target functionaltest_parallel -j 2 -- -k 0
exit_code="$?"
cmake --build build --target functionaltest_summary
exit "$exit_code"
- if: ${{ matrix.test == 'oldtest' }}
name: ${{ matrix.test }}
name: oldtest
timeout-minutes: 20
run: make -C test/old/testdir NVIM_PRG=$(realpath build)/bin/nvim
- if: ${{ matrix.test != 'oldtest' }}
name: ${{ matrix.test }}
timeout-minutes: 20
run: cmake --build build --target ${{ matrix.test }}
- name: Install
run: |
cmake --install build

View File

@@ -54,7 +54,15 @@ jobs:
- if: ${{ matrix.test == 'functional' }}
name: functionaltest
timeout-minutes: ${{ inputs.functionaltest_timeout }}
run: cmake --build build --target functionaltest
env:
# With parallel tests, use shorter timeout for a single group.
TEST_TIMEOUT: 600
run: |
$ErrorActionPreference = 'Continue'
cmake --build build --target functionaltest_parallel -j 2 -- -k 0
$exitCode = $LASTEXITCODE
cmake --build build --target functionaltest_summary
exit $exitCode
- if: ${{ matrix.test == 'old' }}
uses: msys2/setup-msys2@v2