ci: add CI-unit-tests-asan-coverage workflow#5618
Conversation
Builds ProxySQL with PROXYSQLGENAI=1 + WITHASAN=1 + WITHGCOV=1 (and the NOJEMALLOC=1 that ASAN forces), then builds and runs every unit test under test/tap/tests/unit/ and publishes an LCOV coverage report. Self-contained design: unlike the existing CI-taptests-asan workflow this one runs entirely on the GitHub runner. It does not depend on the private proxysql/jenkins-build-scripts repo or any backend MySQL/Docker infrastructure because unit tests link against libproxysql.a via the stub test_globals.o and run as standalone binaries. Full job definition lives in this file rather than being delegated to a reusable workflow on the GH-Actions branch. Key points: - Deps are built with 'make build_deps' (optimized, with debug symbols) rather than build_deps_debug: third-party code is not what we want to instrument, and a non-debug deps build is significantly faster. - lib + src are built with 'make debug' so ASAN / gcov instrument ProxySQL's own code only. - Only test/tap/tests/unit/ is built via 'make unit_tests'; the integration TAP tests under test/tap/tests/ are intentionally skipped because they require running backends. - ASAN_OPTIONS starts with detect_leaks=0 because the existing unit tests were not written leak-free. Flipping this to =1 once those leaks are cleaned up will immediately turn this workflow into a leak regression guard. - vm.mmap_rnd_bits is lowered to 28 at the start of the job to satisfy ASAN's shadow-memory requirement on modern kernels (include/makefiles_vars.mk explicitly warns about this). - Trigger uses the same workflow_run: [CI-trigger] pattern as the rest of the CI-* files in this directory, plus workflow_dispatch for manual runs. Artifacts on every run (pass or fail): - unit-tests-coverage-lcov-<sha>: the merged lcov .info file - unit-tests-coverage-html-<sha>: genhtml output directory - unit-tests-logs-<sha>: per-test stdout/stderr captures Security: every 'run:' step only consumes values from env: (SHA, ASAN_OPTIONS, etc.) or GitHub-provided variables like \$GITHUB_WORKSPACE. No untrusted user input (PR titles, issue bodies, commit messages, fork branch names, etc.) is interpolated into shell commands, so there is no command-injection surface.
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughA new GitHub Actions workflow is added that triggers on CI-trigger completion or manual dispatch. It provisions Ubuntu 24.04, installs coverage and build dependencies, compiles ProxySQL with ASAN and gcov flags, executes unit test binaries, and generates coverage reports via lcov and genhtml, uploading artifacts upon completion. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|


Summary
Adds a new, self-contained CI workflow that builds ProxySQL with
PROXYSQLGENAI=1+WITHASAN=1(forcesNOJEMALLOC=1) +WITHGCOV=1, then builds and runs every unit test undertest/tap/tests/unit/and publishes an LCOV coverage report.This is intentionally kept separate from the existing (currently disabled)
CI-unittestsworkflow, and is designed around three constraints:Runs on the GitHub runner, not inside the shared build cache.
Unlike the other
CI-taptests-*workflows this one does not require the privateproxysql/jenkins-build-scriptsrepo or any backend MySQL/Docker infrastructure. Unit tests link againstlibproxysql.avia the stubtest_globals.oand run as standalone binaries, so the workflow builds and tests directly on the runner. This also sidesteps the 10 GB cache quota issue documented in the disabledCI-unittests.ymltop comment (see ci: shrink _test cache by dropping unit binaries and test/deps (critical) #5603).Targets only
test/tap/tests/unit/, not the integration TAP tests.make unit_testsis invoked viatest/tap/Makefile, which recurses only intotests/unit/. Integration tests undertests/are intentionally skipped because they need running backends.Deps are built with
make build_deps(optimized), notbuild_deps_debug.Third-party code isn't what we want to instrument; ASAN/gcov instrumentation is only needed in ProxySQL's own
lib/andsrc/, which are built withmake debugin the next step.What the workflow does
vm.mmap_rnd_bitsto 28 (ASAN's shadow-memory requirement on modern kernels, explicitly warned about ininclude/makefiles_vars.mk).INSTALL.md's Ubuntu list, pluslcov/fastcovfor coverage.PROXYSQLGENAI=1 NOJEMALLOC=1 WITHASAN=1 WITHGCOV=1.test/tap/tests/unit/*-tbinary underASAN_OPTIONS=detect_leaks=0:abort_on_error=1:halt_on_error=1:symbolize=1:print_stacktrace=1.detect_leaks=0because existing unit tests were not written leak-free. Flipping to=1later will immediately turn this workflow into a leak regression guard.deps/,test/,/usr/).unit-tests-coverage-lcov-<sha>— rawlcov.infounit-tests-coverage-html-<sha>—genhtmloutput treeunit-tests-logs-<sha>— per-test stdout/stderrLouisBrunner/checks-actioncheck-run convention for status reporting.Triggers
workflow_run: [CI-trigger]— same cascade pattern as every otherCI-*workflow in this directory.workflow_dispatch— manual runs from the Actions tab.Security
Every
run:step in the workflow only consumes values fromenv:(SHA, ASAN_OPTIONS, …) or GitHub-provided variables like$GITHUB_WORKSPACE. No untrusted user input (PR titles, issue bodies, commit messages, fork branch names, etc.) is interpolated into shell commands, so there is no command-injection surface.Test plan
v3.0(workflow_runlisteners only fire for workflows present on the default branch).gh workflow run CI-unit-tests-asan-coverage -r v3.0or the Actions UI to verify the full PROXYSQLGENAI + ASAN + gcov build succeeds.lib/andsrc/.unit-tests-logs-<sha>).Known unknowns
PROXYSQLGENAI=1(Rust-linked deps) + gcov all compile together cleanly — this is an untested combination. If the link step fails on a Rust-backed crate, the likely fix is addingRUSTFLAGSfor ASAN.Summary by CodeRabbit