CI: Decouple build and test into separate scripts, simplify workflows (#7871)
- Split the monolithic ci-script.bash into ci-build.bash and
ci-test.bash, with shared setup in ci-common.bash.
- Pass job parameters as explicit command-line options rather than
environment variables (--compiler, --prefix, --suite, --asan,
--gcov, --reloc, --ccwarn).
- Detect the host OS and distribution at runtime (uname,
/etc/os-release) instead of the legacy Travis-era CI_OS_NAME,
CI_RUNS_ON and CI_BUILD_STAGE_NAME variables.
- Remove dead code: FreeBSD support, Windows wavediff install, the
unused CI_COMMIT variable, and various redundant operations.
- Inline the single-entry build-job matrices.
- Rename osx to macOS
- Refuse to run these ci scripts outside GitHub Actions to protect
developer checkouts.
2026-07-05 16:46:30 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# DESCRIPTION: Verilator: CI test job script
|
|
|
|
|
#
|
|
|
|
|
# SPDX-FileCopyrightText: 2026 Wilson Snyder
|
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Executed in the 'test' stage.
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Destructive to the checkout (runs 'find . -delete'); never run locally
|
|
|
|
|
if [ "$GITHUB_ACTIONS" != "true" ]; then
|
|
|
|
|
echo "ERROR: $(basename "$0") must only be run in GitHub Actions CI" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
|
|
source "$(dirname "$0")/ci-common.bash"
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Parse arguments
|
|
|
|
|
|
|
|
|
|
OPT_RELOC=
|
|
|
|
|
OPT_SUITE=
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--reloc)
|
|
|
|
|
[ $# -ge 2 ] || fatal "--reloc requires an argument"
|
|
|
|
|
OPT_RELOC="$2"
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
--suite)
|
|
|
|
|
[ $# -ge 2 ] || fatal "--suite requires an argument"
|
|
|
|
|
OPT_SUITE="$2"
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
*) fatal "Unknown option: '$1'" ;;
|
|
|
|
|
esac
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
[ -n "$OPT_SUITE" ] || fatal "--suite is required"
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Run tests
|
|
|
|
|
|
|
|
|
|
export VERILATOR_TEST_NO_CONTRIBUTORS=1 # Separate workflow check
|
|
|
|
|
export VERILATOR_TEST_NO_LINT_PY=1 # Separate workflow check
|
|
|
|
|
|
|
|
|
|
if [ "$HOST_OS" = "macOS" ]; then
|
|
|
|
|
export VERILATOR_TEST_NO_GDB=1 # No working GDB on macOS
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
TEST_REGRESS=test_regress
|
|
|
|
|
if [ -n "$OPT_RELOC" ]; then
|
|
|
|
|
# Testing that the installation is relocatable.
|
|
|
|
|
"$MAKE" install
|
|
|
|
|
# Install prefix, as configured into the Makefile at build time
|
|
|
|
|
INSTALL_DIR=$(sed -n 's/^prefix = //p' Makefile)
|
|
|
|
|
mkdir -p "$OPT_RELOC"
|
|
|
|
|
mv "$INSTALL_DIR" "$OPT_RELOC/relocated-install"
|
|
|
|
|
export VERILATOR_ROOT="$OPT_RELOC/relocated-install/share/verilator"
|
|
|
|
|
TEST_REGRESS="$OPT_RELOC/test_regress"
|
|
|
|
|
mv test_regress "$TEST_REGRESS"
|
|
|
|
|
NODIST="$OPT_RELOC/nodist"
|
|
|
|
|
mv nodist "$NODIST"
|
|
|
|
|
# Delete everything else
|
|
|
|
|
find . -delete
|
|
|
|
|
ls -la .
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Run the specified suite
|
|
|
|
|
ccache -z
|
CI: Improve ccache handling in build and test jobs (#7874)
Cache key isolation: Include the build flavour (ccwarn/asan/gcov) in the
build ccache key, so the coverage (gcov), asan, and RTLMeter
(ccwarn-off) configurations no longer share and thrash the single
'<runs-on>-<cc>' bucket, nor warm-start from each other's (near-useless)
caches.
Prune stale entries instead of a fixed size cap: After building/testing,
evict ccache entries this run did not touch (--evict-older-than, based
on the run's own duration). This bounds the saved cache to the current
working set, so CCACHE_MAXSIZE and CCACHE_LIMIT_MULTIPLE are no longer
needed and are removed (ccache falls back to its 5G default ceiling, but
is realistically much smaller).
ccache configuration:
- Drop CCACHE_COMPRESS (already the default in ccache 4.x).
- Add CCACHE_COMPILERCHECK=content, so a changed compiler mtime on a rebuilt
ephemeral runner image does not invalidate the whole restored cache.
- Hoist all ccache-related variables (CACHE_BASE_KEY, CCACHE_*, CXX) to the
workflow-level env.
Remove dead ccache scaffolding:
- reusable-lint-py: the job never compiles or caches; drop its ccache env.
- reusable-rtlmeter-run: remove the disabled persistent-cache step and its
storage variables; keep CCACHE_DISABLE=1, since caching must stay off to
keep RTLMeter timings representative.
Store test job ccache as artifacts for reuse
2026-07-06 02:44:32 +02:00
|
|
|
TEST_START=$SECONDS
|
CI: Decouple build and test into separate scripts, simplify workflows (#7871)
- Split the monolithic ci-script.bash into ci-build.bash and
ci-test.bash, with shared setup in ci-common.bash.
- Pass job parameters as explicit command-line options rather than
environment variables (--compiler, --prefix, --suite, --asan,
--gcov, --reloc, --ccwarn).
- Detect the host OS and distribution at runtime (uname,
/etc/os-release) instead of the legacy Travis-era CI_OS_NAME,
CI_RUNS_ON and CI_BUILD_STAGE_NAME variables.
- Remove dead code: FreeBSD support, Windows wavediff install, the
unused CI_COMMIT variable, and various redundant operations.
- Inline the single-entry build-job matrices.
- Rename osx to macOS
- Refuse to run these ci scripts outside GitHub Actions to protect
developer checkouts.
2026-07-05 16:46:30 +02:00
|
|
|
case $OPT_SUITE in
|
|
|
|
|
dist-vlt-0)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt --driver-clean" DRIVER_HASHSET=--hashset=0/4
|
|
|
|
|
;;
|
|
|
|
|
dist-vlt-1)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt --driver-clean" DRIVER_HASHSET=--hashset=1/4
|
|
|
|
|
;;
|
|
|
|
|
dist-vlt-2)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt --driver-clean" DRIVER_HASHSET=--hashset=2/4
|
|
|
|
|
;;
|
|
|
|
|
dist-vlt-3)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt --driver-clean" DRIVER_HASHSET=--hashset=3/4
|
|
|
|
|
;;
|
|
|
|
|
vltmt-0)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt --driver-clean" DRIVER_HASHSET=--hashset=0/3
|
|
|
|
|
;;
|
|
|
|
|
vltmt-1)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt --driver-clean" DRIVER_HASHSET=--hashset=1/3
|
|
|
|
|
;;
|
|
|
|
|
vltmt-2)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt --driver-clean" DRIVER_HASHSET=--hashset=2/3
|
|
|
|
|
;;
|
|
|
|
|
coverage-dist)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist"
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-0)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=0/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-1)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=1/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-2)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=2/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-3)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=3/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-4)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=4/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-5)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=5/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-6)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=6/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-7)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=7/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-8)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=8/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vlt-9)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vlt" DRIVER_HASHSET=--hashset=9/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-0)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=0/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-1)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=1/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-2)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=2/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-3)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=3/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-4)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=4/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-5)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=5/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-6)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=6/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-7)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=7/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-8)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=8/10
|
|
|
|
|
;;
|
|
|
|
|
coverage-vltmt-9)
|
|
|
|
|
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--vltmt" DRIVER_HASHSET=--hashset=9/10
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
fatal "Unknown suite: $OPT_SUITE"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
ccache -svv
|
CI: Improve ccache handling in build and test jobs (#7874)
Cache key isolation: Include the build flavour (ccwarn/asan/gcov) in the
build ccache key, so the coverage (gcov), asan, and RTLMeter
(ccwarn-off) configurations no longer share and thrash the single
'<runs-on>-<cc>' bucket, nor warm-start from each other's (near-useless)
caches.
Prune stale entries instead of a fixed size cap: After building/testing,
evict ccache entries this run did not touch (--evict-older-than, based
on the run's own duration). This bounds the saved cache to the current
working set, so CCACHE_MAXSIZE and CCACHE_LIMIT_MULTIPLE are no longer
needed and are removed (ccache falls back to its 5G default ceiling, but
is realistically much smaller).
ccache configuration:
- Drop CCACHE_COMPRESS (already the default in ccache 4.x).
- Add CCACHE_COMPILERCHECK=content, so a changed compiler mtime on a rebuilt
ephemeral runner image does not invalidate the whole restored cache.
- Hoist all ccache-related variables (CACHE_BASE_KEY, CCACHE_*, CXX) to the
workflow-level env.
Remove dead ccache scaffolding:
- reusable-lint-py: the job never compiles or caches; drop its ccache env.
- reusable-rtlmeter-run: remove the disabled persistent-cache step and its
storage variables; keep CCACHE_DISABLE=1, since caching must stay off to
keep RTLMeter timings representative.
Store test job ccache as artifacts for reuse
2026-07-06 02:44:32 +02:00
|
|
|
ccache --evict-older-than "$((SECONDS - TEST_START + 60))s"
|
|
|
|
|
ccache -svv
|
CI: Decouple build and test into separate scripts, simplify workflows (#7871)
- Split the monolithic ci-script.bash into ci-build.bash and
ci-test.bash, with shared setup in ci-common.bash.
- Pass job parameters as explicit command-line options rather than
environment variables (--compiler, --prefix, --suite, --asan,
--gcov, --reloc, --ccwarn).
- Detect the host OS and distribution at runtime (uname,
/etc/os-release) instead of the legacy Travis-era CI_OS_NAME,
CI_RUNS_ON and CI_BUILD_STAGE_NAME variables.
- Remove dead code: FreeBSD support, Windows wavediff install, the
unused CI_COMMIT variable, and various redundant operations.
- Inline the single-entry build-job matrices.
- Rename osx to macOS
- Refuse to run these ci scripts outside GitHub Actions to protect
developer checkouts.
2026-07-05 16:46:30 +02:00
|
|
|
uptime # To see load average
|