Skip to content

Commit dbd543a

Browse files
committed
Add soak test suite: diagnostics + compressed workload + CI jobs
CBM_DIAGNOSTICS=1 writes /tmp/cbm-diagnostics-<pid>.json every 5s. scripts/soak-test.sh: compressed workload + crash recovery + analysis. CI: soak_level input (full/quick/none) on dry-run + release. MCP query timing via cbm_diag_record_query().
1 parent 7d64008 commit dbd543a

File tree

8 files changed

+742
-4
lines changed

8 files changed

+742
-4
lines changed

.github/workflows/dry-run.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
description: 'Skip build+smoke steps (faster iteration on lint/tests)'
1616
type: boolean
1717
default: false
18+
soak_level:
19+
description: 'Soak test level: full (quick+asan+nightly), quick (10min only), none'
20+
type: choice
21+
options: ['full', 'quick', 'none']
22+
default: 'quick'
1823

1924
permissions:
2025
contents: read
@@ -503,3 +508,88 @@ jobs:
503508
exit 1
504509
}
505510
Write-Host "=== Windows Defender: clean ==="
511+
512+
# ── Step 6: Soak tests (after smoke, per-platform) ──────────
513+
soak-quick:
514+
if: ${{ inputs.soak_level != 'none' && !inputs.skip_builds }}
515+
needs: [smoke-unix]
516+
runs-on: ${{ matrix.os }}
517+
timeout-minutes: 30
518+
strategy:
519+
fail-fast: false
520+
matrix:
521+
include:
522+
- os: ubuntu-latest
523+
goos: linux
524+
goarch: amd64
525+
cc: gcc
526+
cxx: g++
527+
- os: ubuntu-24.04-arm
528+
goos: linux
529+
goarch: arm64
530+
cc: gcc
531+
cxx: g++
532+
- os: macos-14
533+
goos: darwin
534+
goarch: arm64
535+
cc: cc
536+
cxx: c++
537+
steps:
538+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
539+
540+
- name: Install deps (Linux)
541+
if: startsWith(matrix.os, 'ubuntu')
542+
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 git
543+
544+
- name: Build (release mode)
545+
run: scripts/build.sh CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
546+
547+
- name: Quick soak (10 min)
548+
run: scripts/soak-test.sh build/c/codebase-memory-mcp 10
549+
550+
- name: Upload soak metrics
551+
if: always()
552+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
553+
with:
554+
name: soak-quick-${{ matrix.goos }}-${{ matrix.goarch }}
555+
path: soak-results/
556+
retention-days: 14
557+
558+
soak-asan:
559+
if: ${{ inputs.soak_level == 'full' && !inputs.skip_builds }}
560+
needs: [smoke-unix]
561+
runs-on: ${{ matrix.os }}
562+
timeout-minutes: 45
563+
strategy:
564+
fail-fast: false
565+
matrix:
566+
include:
567+
- os: ubuntu-latest
568+
goarch: amd64
569+
- os: ubuntu-24.04-arm
570+
goarch: arm64
571+
steps:
572+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
573+
574+
- name: Install deps
575+
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 git
576+
577+
- name: Build (ASan + LeakSanitizer)
578+
run: |
579+
scripts/test.sh CC=gcc CXX=g++
580+
# test.sh builds with ASan; the test-runner binary has ASan linked
581+
cp build/c/test-runner build/c/codebase-memory-mcp-asan || true
582+
scripts/build.sh CC=gcc CXX=g++
583+
584+
- name: ASan soak (15 min)
585+
env:
586+
ASAN_OPTIONS: "detect_leaks=1:halt_on_error=0"
587+
run: scripts/soak-test.sh build/c/codebase-memory-mcp 15
588+
589+
- name: Upload ASan soak metrics
590+
if: always()
591+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
592+
with:
593+
name: soak-asan-linux-${{ matrix.goarch }}
594+
path: soak-results/
595+
retention-days: 14

.github/workflows/release.yml

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
required: false
1717
type: boolean
1818
default: false
19+
soak_level:
20+
description: 'Soak test level: full (quick+asan), quick (10min only), none (skip)'
21+
type: choice
22+
options: ['full', 'quick', 'none']
23+
default: 'quick'
1924

2025
permissions:
2126
contents: write
@@ -505,9 +510,84 @@ jobs:
505510
}
506511
Write-Host "=== Windows Defender: clean ==="
507512
508-
# ── Step 5: Create DRAFT release (not public yet) ─────────────
513+
# ── Step 5a: Quick soak (parallel with smoke, per-platform) ────
514+
soak-quick:
515+
if: ${{ inputs.soak_level != 'none' }}
516+
needs: [build-unix]
517+
runs-on: ${{ matrix.os }}
518+
timeout-minutes: 30
519+
strategy:
520+
fail-fast: false
521+
matrix:
522+
include:
523+
- os: ubuntu-latest
524+
goos: linux
525+
goarch: amd64
526+
cc: gcc
527+
cxx: g++
528+
- os: ubuntu-24.04-arm
529+
goos: linux
530+
goarch: arm64
531+
cc: gcc
532+
cxx: g++
533+
- os: macos-14
534+
goos: darwin
535+
goarch: arm64
536+
cc: cc
537+
cxx: c++
538+
steps:
539+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
540+
- name: Install deps (Linux)
541+
if: startsWith(matrix.os, 'ubuntu')
542+
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 git
543+
- name: Build (release mode)
544+
run: scripts/build.sh --version ${{ inputs.version }} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
545+
- name: Quick soak (10 min)
546+
run: scripts/soak-test.sh build/c/codebase-memory-mcp 10
547+
- name: Upload soak metrics
548+
if: always()
549+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
550+
with:
551+
name: soak-quick-${{ matrix.goos }}-${{ matrix.goarch }}
552+
path: soak-results/
553+
retention-days: 14
554+
555+
# ── Step 5b: ASan soak (Linux only, parallel) ─────────────────
556+
soak-asan:
557+
if: ${{ inputs.soak_level == 'full' }}
558+
needs: [build-unix]
559+
runs-on: ${{ matrix.os }}
560+
timeout-minutes: 45
561+
strategy:
562+
fail-fast: false
563+
matrix:
564+
include:
565+
- os: ubuntu-latest
566+
goarch: amd64
567+
- os: ubuntu-24.04-arm
568+
goarch: arm64
569+
steps:
570+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
571+
- name: Install deps
572+
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 git
573+
- name: Build (release mode for soak)
574+
run: scripts/build.sh CC=gcc CXX=g++
575+
- name: ASan soak (15 min)
576+
env:
577+
ASAN_OPTIONS: "detect_leaks=1:halt_on_error=0"
578+
run: scripts/soak-test.sh build/c/codebase-memory-mcp 15
579+
- name: Upload ASan soak metrics
580+
if: always()
581+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
582+
with:
583+
name: soak-asan-linux-${{ matrix.goarch }}
584+
path: soak-results/
585+
retention-days: 14
586+
587+
# ── Step 6: Create DRAFT release (not public yet) ─────────────
509588
release-draft:
510-
needs: [smoke-unix, smoke-windows, security-static, codeql-gate]
589+
needs: [smoke-unix, smoke-windows, security-static, codeql-gate, soak-quick]
590+
if: ${{ !cancelled() && !failure() }}
511591
runs-on: ubuntu-latest
512592
permissions:
513593
contents: write

Makefile.cbm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ FOUNDATION_SRCS = \
101101
src/foundation/compat_thread.c \
102102
src/foundation/compat_fs.c \
103103
src/foundation/compat_regex.c \
104-
src/foundation/mem.c
104+
src/foundation/mem.c \
105+
src/foundation/diagnostics.c
105106

106107
# Existing extraction C code (compiled from current location)
107108
EXTRACTION_SRCS = \

0 commit comments

Comments
 (0)