diff --git a/.gitignore b/.gitignore index 9c4e659..ece2016 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .project_rules AGENTS.md build + +/build-ci/ diff --git a/README.md b/README.md index aa3e7b2..0b2386c 100644 --- a/README.md +++ b/README.md @@ -1355,6 +1355,18 @@ source lists live in `tests/parser_tests.pri` and `tests/decoder_tests.pri`. When building a consumer separately, pass `DBC_CORE_BUILD_DIR=/absolute/path/to/build/core` to qmake. +### Local core regression checks + +Run `bash tests/run_core_ci.sh release` or `bash tests/run_core_ci.sh sanitize` +to build the core archive with Qt 6.8.2, run all six core QtTest suites (parser, +decoder, coverage, lifetime, validation, and pipeline/builder integration), and +run both the qmake and standalone Qt-free tree tests. The sanitizer mode uses +AddressSanitizer and UndefinedBehaviorSanitizer, with leak detection enabled by +default and fatal sanitizer errors. + +See [Local regression checks](tests/README.md#local-regression-checks) for +prerequisites and environment overrides. No automatic CI workflow is configured. + ### Build core without Qt libraries From the repository root: diff --git a/changelog.md b/changelog.md index eeed2d1..d0ae0b1 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,15 @@ existing Git tag; subsequent changes are listed as unreleased. ### 2026-10-23 +#### Testing + +- Add local Release and ASan/UBSan commands in `tests/run_core_ci.sh` for the + core archive, all six core regression suites, and qmake/standalone tree tests, + with separate build directories and fatal test/sanitizer failures. +- Verify clean Release and ASan/UBSan builds: each passed 2,397 QtTest checks + without skips plus qmake and standalone tree tests. Local leak checking is + blocked by ptrace. Validate shell syntax and build-failure propagation. + #### Fixed - Read attribute definitions, defaults, and assignments across physical lines. diff --git a/tests/README.md b/tests/README.md index 3f8e589..dd0dac2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -45,6 +45,39 @@ make check `dbc_validation_test.cpp`, and `dbc_pipeline_test.cpp`. `../core/core.pri` supplies the library include path and linkage. +## Local regression checks + +`run_core_ci.sh` builds the core archive, runs all six QtTest suites and the +qmake tree target with `make check`, then compiles and runs the standalone C++17 +tree/builder test without Qt. A failed command returns a nonzero status. The +`sanitize` mode applies ASan/UBSan flags to core, tests, and the standalone +executable, with leak detection enabled by default and sanitizer errors fatal. +The optional adapter is not built. No automatic CI workflow is configured. + +From the repository root, with Qt 6.8.2 available: + +```sh +bash tests/run_core_ci.sh release +bash tests/run_core_ci.sh sanitize +``` + +Build directories default to `build-ci/release` and `build-ci/sanitize`; an +optional second argument selects another directory. Always use separate build +directories for the two modes. `QMAKE`, `CXX`, and `JOBS` override the qmake +executable, standalone compiler, and build parallelism (default 4). Generate the +locale as described below and set `LOCPATH` locally to run without locale skips. +On hosts where LeakSanitizer cannot work under a tracer, run with +`ASAN_OPTIONS=detect_leaks=0:halt_on_error=1`; this disables local leak checking +only. Test output is written to the terminal. + +Validation of this script used clean builds in `/tmp/dbc-ci-release` +and `/tmp/dbc-ci-sanitize` with Qt 6.8.2 and the generated German locale. Each +mode passed 2,397 QtTest checks with no failures or skips, the qmake tree test, +and the standalone tree test. The sanitizer run used `detect_leaks=0` because +an explicit leak-enabled run failed with LeakSanitizer's ptrace restriction. +Shell syntax, invalid-mode handling, and nonzero propagation of a failed qmake +command were also checked. + ## Decoder coverage Coverage includes Motorola bit numbering within and across bytes, unaligned diff --git a/tests/run_core_ci.sh b/tests/run_core_ci.sh new file mode 100644 index 0000000..8b9047d --- /dev/null +++ b/tests/run_core_ci.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Build core and run the local regression checks. +set -euo pipefail + +mode=${1:-release} +source_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +build_dir=${2:-"$source_dir/build-ci/$mode"} +qmake_args=() +compiler_flags=() + +case "$mode" in + release) + qmake_args+=(CONFIG+=release CONFIG-=debug) + compiler_flags+=(-O2) + ;; + sanitize) + qmake_args+=(CONFIG+=debug CONFIG-=release + 'QMAKE_CXXFLAGS+=-fsanitize=address,undefined -fno-omit-frame-pointer' + 'QMAKE_LFLAGS+=-fsanitize=address,undefined') + compiler_flags+=(-g -fsanitize=address,undefined -fno-omit-frame-pointer) + export ASAN_OPTIONS=${ASAN_OPTIONS:-detect_leaks=1:halt_on_error=1} + export UBSAN_OPTIONS=${UBSAN_OPTIONS:-halt_on_error=1:print_stacktrace=1} + ;; + *) + echo "Usage: $0 [release|sanitize] [build-directory]" >&2 + exit 2 + ;; +esac + +export QT_FATAL_WARNINGS=${QT_FATAL_WARNINGS:-1} +mkdir -p -- "$build_dir" +cd -- "$build_dir" +"${QMAKE:-qmake6}" "$source_dir/dbc.pro" "${qmake_args[@]}" +make -j"${JOBS:-4}" +make check + +# Also verify that the tree and its builder compile and run without Qt. +"${CXX:-c++}" -std=c++17 "${compiler_flags[@]}" -I"$source_dir/core" \ + "$source_dir/tests/tree_node_test.cpp" "$source_dir/core/tree_node.cpp" \ + "$source_dir/core/dbc_tree_builder.cpp" -o dbc_tree_standalone_test +./dbc_tree_standalone_test