test(layer): regression test for issue #79 stale now_ns race #650
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-matrix: | |
| name: check / ${{ matrix.os }} / ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04] | |
| name: [default, wasm-false, libusb-false] | |
| include: | |
| - name: default | |
| zig_args: "" | |
| - name: wasm-false | |
| zig_args: -Dwasm=false | |
| - name: libusb-false | |
| zig_args: -Dlibusb=false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Install system dependencies | |
| if: matrix.name != 'libusb-false' | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libusb-1.0-0-dev | |
| # Three separate `zig build` processes (Option C from PR #166 fc4937b) | |
| # to avoid Zig issue #22453 inter-step flock contention. Each process | |
| # has its own .zig-cache lock space. | |
| # NOTE: -j1 was tried (commits 9892e14 + 0e330b9) but caused a separate | |
| # Zig scheduler deadlock — empirically reproduced in container. The real | |
| # CI hang was a test-level blocking-pipe issue (TP33), fixed in edf7224. | |
| # Removing -j1 here. | |
| - name: Run all checks (serial via separate processes) | |
| run: | | |
| set -eo pipefail | |
| timeout 600 zig build ${{ matrix.zig_args }} test --summary all 2>&1 | tee test.log | |
| timeout 600 zig build ${{ matrix.zig_args }} test-safe --summary all 2>&1 | tee test-safe.log | |
| timeout 600 zig build ${{ matrix.zig_args }} check-fmt 2>&1 | tee check-fmt.log | |
| check: | |
| name: check | |
| runs-on: ubuntu-22.04 | |
| needs: [check-matrix] | |
| if: ${{ always() }} | |
| steps: | |
| - name: Require check matrix success | |
| run: | | |
| if [ "${{ needs.check-matrix.result }}" != "success" ]; then | |
| echo "check-matrix result: ${{ needs.check-matrix.result }}" | |
| exit 1 | |
| fi | |
| tsan: | |
| name: tsan / ubuntu-22.04 | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libusb-1.0-0-dev gdb | |
| - name: Run TSAN tests | |
| run: | | |
| set -o pipefail | |
| rm -rf .zig-cache | |
| export TSAN_OPTIONS="halt_on_error=1:verbosity=1:history_size=7:log_path=$PWD/tsan" | |
| timeout 600 zig build test-tsan --summary all 2>&1 | tee tsan-build.log | |
| - name: TSAN diagnostics | |
| if: failure() | |
| run: | | |
| set -euo pipefail | |
| echo "==== TSAN summary from build log ====" | |
| grep -nE "ThreadSanitizer|data race|thread leak|SUMMARY|signal [0-9]+|terminated with signal|error: while executing test" tsan-build.log || true | |
| FAILED_CMD="$(grep -E '^\.?/?\.zig-cache/o/.+/test --cache-dir=' tsan-build.log | tail -n 1 || true)" | |
| if [ -n "${FAILED_CMD}" ]; then | |
| echo "${FAILED_CMD}" > tsan-failed-cmd.txt | |
| echo "==== Re-running failed test command once ====" | |
| bash -lc "${FAILED_CMD}" > tsan-rerun.log 2>&1 || true | |
| echo "==== Running failed command under gdb ====" | |
| eval "set -- ${FAILED_CMD}" | |
| gdb -q -batch \ | |
| -ex "set pagination off" \ | |
| -ex "set confirm off" \ | |
| -ex "run" \ | |
| -ex "thread apply all bt full" \ | |
| --args "$@" > tsan-gdb.log 2>&1 || true | |
| fi | |
| echo "==== TSAN log files ====" | |
| ls -lah tsan* || true | |
| - name: Upload TSAN logs | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tsan-logs | |
| path: | | |
| tsan-build.log | |
| tsan-failed-cmd.txt | |
| tsan-rerun.log | |
| tsan-gdb.log | |
| tsan* | |
| distro-check: | |
| name: distro-check / ${{ matrix.name }} | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: debian-12 | |
| image: debian:12 | |
| setup: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl xz-utils gcc g++ make pkg-config linux-libc-dev | |
| - name: fedora-41 | |
| image: fedora:41 | |
| setup: dnf install -y ca-certificates curl xz gcc gcc-c++ make pkgconf-pkg-config kernel-headers glibc-headers glibc-devel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run check-all in container | |
| env: | |
| DISTRO_IMAGE: ${{ matrix.image }} | |
| DISTRO_SETUP: ${{ matrix.setup }} | |
| run: | | |
| set -euo pipefail | |
| docker run --rm \ | |
| -v "$PWD:/work" \ | |
| -w /work \ | |
| "$DISTRO_IMAGE" \ | |
| /bin/sh -lc " | |
| set -eu | |
| ${DISTRO_SETUP} | |
| curl -fsSL https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz -o /tmp/zig.tar.xz | |
| tar -xJf /tmp/zig.tar.xz -C /tmp | |
| timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false test --summary all | |
| timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false test-safe --summary all | |
| timeout 600 /tmp/zig-x86_64-linux-0.15.2/zig build -Dlibusb=false check-fmt | |
| " 2>&1 | tee distro-check.log |