Same bug class asdae8a50and6d8087f: under -DNDEBUG (CMake's default for Release, which CI uses) the assert macro expands to ((void)0) and the wrapped expression is not evaluated. Calls inside assert() are silently dropped. Found 6 occurrences in test_ots.c (uc2_ots_varint_decode, parse_file) where the call writes through output pointers. Under Release builds these tests silently no-op rather than testing anything. Converted to capture-then-check. Audit otherwise clean: production code (lib/, cli/) has only one assert-on-call, and it wraps a pure arithmetic helper. Adds tests/scripts/check_assert_side_effects.py as a CI gate to keep this class of bug out: matches assert(IDENT(...)) where IDENT contains a side-effect verb (encode/decode/parse/...). Pure queries (_equal, _match, _verify, _has_, _is_, _id, _root, _attest_name, memcmp, ...) are not flagged. Wired into build.yml on the Linux runner. Also gitignore Testing/ (CTest run outputs) and __pycache__/.
37 lines
1018 B
YAML
37 lines
1018 B
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { os: ubuntu-latest, name: Linux }
|
|
- { os: macos-latest, name: macOS }
|
|
- { os: windows-latest, name: Windows (MSVC) }
|
|
runs-on: ${{ matrix.os }}
|
|
name: ${{ matrix.name }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Lint -- forbid assert(side-effect)
|
|
if: runner.os == 'Linux'
|
|
run: python3 tests/scripts/check_assert_side_effects.py
|
|
- name: Configure
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
|
|
- name: Build
|
|
run: cmake --build build --config Release
|
|
- name: Smoke test (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: ./build/cli/uc2 -h
|
|
- name: Smoke test (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: .\build\cli\Release\uc2.exe -h
|
|
- name: Test
|
|
run: ctest --test-dir build --output-on-failure -C Release
|