From e42a142ef81447031b85d580233bd2838882be51 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Mon, 16 Nov 2026 11:21:04 -0800 Subject: [PATCH 1/7] veristat: flatten results and share corpus diagnostics Per-corpus directories repeat status and log files in the OSS artifact, including empty stderr files for small workloads. Write corpus CSVs directly in the results directory, share diagnostic logs with corpus labels, and record progress in one atomic status map. Keep corpus identities and the existing measurement/error semantics. Adapt both workflow consumers; Meta continues uploading only its CSV. Baseline CSV names, contents and cache paths are unchanged. Signed-off-by: Ihor Solodrai --- .github/workflows/veristat-meta.yml | 13 +++---- .github/workflows/veristat-oss.yml | 11 +++--- ci/veristat/README.md | 7 ++-- ci/veristat/run_veristat.py | 47 ++++++++++++++++---------- ci/veristat/tests/test_run_veristat.py | 8 ++++- 5 files changed, 53 insertions(+), 33 deletions(-) diff --git a/.github/workflows/veristat-meta.yml b/.github/workflows/veristat-meta.yml index f5b27103..7a8db520 100644 --- a/.github/workflows/veristat-meta.yml +++ b/.github/workflows/veristat-meta.yml @@ -94,10 +94,11 @@ jobs: from pathlib import Path results = Path(os.environ["VERISTAT_RESULTS"]) + status_file = results / "status.json" + statuses = json.loads(status_file.read_text()) if status_file.exists() else {} measured = [ - status.parent.name - for status in sorted(results.glob("*/status.json")) - if json.loads(status.read_text())["state"] == "measured" + name for name, status in sorted(statuses.items()) + if status["state"] == "measured" ] with open(os.environ["GITHUB_OUTPUT"], "a") as output: output.write(f"measured={' '.join(measured)}\n") @@ -109,7 +110,7 @@ jobs: with: name: veristat-meta-${{ env.ARCH_AND_TOOL }} if-no-files-found: warn - path: ${{ env.VERISTAT_RESULTS }}/*/results.csv + path: ${{ env.VERISTAT_RESULTS }}/meta.csv - name: Restore veristat baseline if: ${{ !cancelled() }} @@ -129,7 +130,7 @@ jobs: for corpus in ${MEASURED}; do echo "# ${corpus} corpus" | tee -a "${GITHUB_STEP_SUMMARY}" BASELINE_PATH="${VERISTAT_BASELINE}/${corpus}.csv" \ - VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}/results.csv" \ + VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}.csv" \ ./ci/veristat/compare-veristat-results.sh || status=1 # A comparison table ends in without a newline; a blank # line keeps the next corpus heading out of that HTML block. @@ -144,7 +145,7 @@ jobs: run: | mkdir -p "${VERISTAT_BASELINE}" for corpus in ${MEASURED}; do - cp "${VERISTAT_RESULTS}/${corpus}/results.csv" "${VERISTAT_BASELINE}/${corpus}.csv" + cp "${VERISTAT_RESULTS}/${corpus}.csv" "${VERISTAT_BASELINE}/${corpus}.csv" done - name: Save veristat baseline diff --git a/.github/workflows/veristat-oss.yml b/.github/workflows/veristat-oss.yml index 9eacacca..696958f4 100644 --- a/.github/workflows/veristat-oss.yml +++ b/.github/workflows/veristat-oss.yml @@ -92,10 +92,11 @@ jobs: from pathlib import Path results = Path(os.environ["VERISTAT_RESULTS"]) + status_file = results / "status.json" + statuses = json.loads(status_file.read_text()) if status_file.exists() else {} measured = [ - status.parent.name - for status in sorted(results.glob("*/status.json")) - if json.loads(status.read_text())["state"] == "measured" + name for name, status in sorted(statuses.items()) + if status["state"] == "measured" ] with open(os.environ["GITHUB_OUTPUT"], "a") as output: output.write(f"measured={' '.join(measured)}\n") @@ -129,7 +130,7 @@ jobs: for corpus in ${MEASURED}; do echo "# ${corpus} corpus" | tee -a "${GITHUB_STEP_SUMMARY}" BASELINE_PATH="${VERISTAT_BASELINE}/${corpus}.csv" \ - VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}/results.csv" \ + VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}.csv" \ ./ci/veristat/compare-veristat-results.sh || status=1 # A comparison table ends in without a newline; a blank # line keeps the next corpus heading out of that HTML block. @@ -144,7 +145,7 @@ jobs: run: | mkdir -p "${VERISTAT_BASELINE}" for corpus in ${MEASURED}; do - cp "${VERISTAT_RESULTS}/${corpus}/results.csv" "${VERISTAT_BASELINE}/${corpus}.csv" + cp "${VERISTAT_RESULTS}/${corpus}.csv" "${VERISTAT_BASELINE}/${corpus}.csv" done - name: Save veristat baseline diff --git a/ci/veristat/README.md b/ci/veristat/README.md index 4d8a57ea..7b00014d 100644 --- a/ci/veristat/README.md +++ b/ci/veristat/README.md @@ -33,8 +33,9 @@ names and object basenames must be unique within each corpus. The output directory must be new. The runner checks object SHA256s and runs one veristat process per corpus with `-o csv -q -e file,prog,verdict,states`. -Each corpus gets `results.csv`, `stderr.log`, and an atomic `status.json`. -Status is `running`, `measured`, or `error`; a missing status means the corpus +Each corpus gets `.csv`. Shared `stderr.log` and `failures.log` label their +contents by corpus. One atomic `status.json` records each corpus's receipt. +Status is `running`, `measured`, or `error`; a missing receipt means the corpus was not started. Interrupted and partial results must not be cached as measured. `measured` requires a zero tool exit status and nonempty, valid program records. @@ -44,7 +45,7 @@ could not be measured. The VM launcher handles VM failure and timeouts. After measuring a corpus with rejected programs, the runner reruns veristat with `-v` for them on the same objects and kernel. Their verifier logs go to -`failures.log`, and the program filter to `failures.cfg`. These are diagnostics; +`failures.log`; the program filter is temporary. These are diagnostics; they do not change the measurement status. Status includes the corpus digest: SHA256 of the sorted SHA256SUMS-style diff --git a/ci/veristat/run_veristat.py b/ci/veristat/run_veristat.py index 3bf03a06..ce517059 100644 --- a/ci/veristat/run_veristat.py +++ b/ci/veristat/run_veristat.py @@ -7,8 +7,10 @@ import json import os from pathlib import Path +import shutil import subprocess import sys +import tempfile CSV_FIELDS = ["file_name", "prog_name", "verdict", "total_states"] @@ -68,15 +70,19 @@ def validate_results(path): return programs, rejected -def record_rejected(veristat, paths, rejected, directory): - config = directory / "failures.cfg" - config.write_text("".join(f"{file}/{program}\n" for file, program in rejected)) +def record_rejected(veristat, paths, rejected, output, name): files = {file for file, _ in rejected} objects = [path for path in paths if Path(path).name in files] - with (directory / "failures.log").open("w") as output: + with tempfile.NamedTemporaryFile(mode="w", suffix=".cfg") as config, ( + output / "failures.log" + ).open("a") as log_file: + config.write("".join(f"{file}/{program}\n" for file, program in rejected)) + config.flush() + log_file.write(f"\n# {name}\n") + log_file.flush() result = subprocess.run( - [str(veristat), "-v", f"-f@{config}"] + objects, - stdout=output, + [str(veristat), "-v", f"-f@{config.name}"] + objects, + stdout=log_file, stderr=subprocess.STDOUT, ) return result.returncode @@ -94,13 +100,16 @@ def measure(veristat, manifest_path, output): if manifest["version"] != 1 or not manifest["corpora"]: raise ValueError("expected a version 1 manifest with at least one corpus") output.mkdir(parents=True) + (output / "stderr.log").touch() statuses = {} for corpus in manifest["corpora"]: name = corpus["name"] - directory = output / name - directory.mkdir() + if name in statuses: + raise ValueError(f"duplicate corpus name: {name}") + csv_path = output / f"{name}.csv" status = {"state": "running"} - write_status(directory, status) + statuses[name] = status + write_status(output, statuses) rejected = [] try: objects = corpus["objects"] @@ -132,35 +141,37 @@ def measure(veristat, manifest_path, output): ] if config: command.append(f"-f@{config}") - with (directory / "results.csv").open("w") as stdout, ( - directory / "stderr.log" - ).open("w") as stderr: + with csv_path.open("w") as stdout, tempfile.TemporaryFile() as stderr: log( f"{name}: running veristat; corpus_sha256={status['corpus_sha256']}" ) result = subprocess.run(command + paths, stdout=stdout, stderr=stderr) + if stderr.tell(): + stderr.seek(0) + with (output / "stderr.log").open("ab") as log_file: + log_file.write(f"\n# {name}\n".encode()) + shutil.copyfileobj(stderr, log_file) status["returncode"] = result.returncode if result.returncode: raise ValueError( f"veristat exited with status {result.returncode}; " - f"stderr={directory / 'stderr.log'}" + f"stderr={output / 'stderr.log'}" ) - programs, rejected = validate_results(directory / "results.csv") + programs, rejected = validate_results(csv_path) status["state"] = "measured" message = f"{name}: measured {programs} programs" except (OSError, ValueError, csv.Error) as error: status.update(state="error", error=str(error)) message = f"{name}: error: {error}" - write_status(directory, status) + write_status(output, statuses) log(message) - statuses[name] = status # Diagnostics only: keep verbose logs from the measured kernel and objects. if rejected: try: - returncode = record_rejected(veristat, paths, rejected, directory) + returncode = record_rejected(veristat, paths, rejected, output, name) log( f"{name}: recorded verifier logs of {len(rejected)} rejected " - f"programs in {directory / 'failures.log'}; exit status {returncode}" + f"programs in {output / 'failures.log'}; exit status {returncode}" ) except OSError as error: log(f"{name}: could not record verifier logs: {error}") diff --git a/ci/veristat/tests/test_run_veristat.py b/ci/veristat/tests/test_run_veristat.py index 839bfecf..70b843c4 100644 --- a/ci/veristat/tests/test_run_veristat.py +++ b/ci/veristat/tests/test_run_veristat.py @@ -52,6 +52,12 @@ def test_changed_object_does_not_pass(self): (self.root / "object.bpf.o").write_bytes(b"changed") self.assertNotEqual(self.invoke(), 0) + def test_duplicate_corpus_does_not_pass(self): + self.manifest.write_text( + json.dumps({"version": 1, "corpora": [self.corpus, self.corpus]}) + ) + self.assertNotEqual(self.invoke(), 0) + def test_completed_receipt_uses_object_basename(self): (self.root / "moved").mkdir() (self.root / "object.bpf.o").rename(self.root / "moved/object.bpf.o") @@ -60,7 +66,7 @@ def test_completed_receipt_uses_object_basename(self): } self.manifest.write_text(json.dumps({"version": 1, "corpora": [self.corpus]})) self.assertEqual(self.invoke(), 0) - status = json.loads((self.results / "test/status.json").read_text()) + status = json.loads((self.results / "status.json").read_text())["test"] self.assertEqual(status["state"], "measured") self.assertEqual( status["corpus_sha256"], From 9b0a02b205ed1ad3f55263ad56a9088de53a39c9 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Mon, 16 Nov 2026 11:23:46 -0800 Subject: [PATCH 2/7] veristat: report all sources in one summary Rendering each source separately repeats headings and tables, including sections for sources with only one program. Report source counts and comparison outcomes in one overview, then pool changed programs with source labels and put new failures first. Include failed, interrupted and unstarted sources even when there are no CSVs. Use the existing comparison parser and baseline rules. Let the report provide measured-source outputs for caching, removing the separate collection step and shell comparison wrapper from both workflows. Signed-off-by: Ihor Solodrai --- .github/workflows/veristat-meta.yml | 50 ++--- .github/workflows/veristat-oss.yml | 49 ++--- ci/veristat/README.md | 18 +- ci/veristat/compare-veristat-results.sh | 35 ---- ci/veristat/veristat_compare.py | 245 +++++++++++++++--------- 5 files changed, 197 insertions(+), 200 deletions(-) delete mode 100755 ci/veristat/compare-veristat-results.sh diff --git a/.github/workflows/veristat-meta.yml b/.github/workflows/veristat-meta.yml index 7a8db520..0a2c5633 100644 --- a/.github/workflows/veristat-meta.yml +++ b/.github/workflows/veristat-meta.yml @@ -85,25 +85,6 @@ jobs: vmlinuz: '${{ github.workspace }}/vmlinuz' kernel-root: '.' - - name: Collect measured corpora - id: state - if: ${{ !cancelled() }} - shell: python3 {0} - run: | - import json, os - from pathlib import Path - - results = Path(os.environ["VERISTAT_RESULTS"]) - status_file = results / "status.json" - statuses = json.loads(status_file.read_text()) if status_file.exists() else {} - measured = [ - name for name, status in sorted(statuses.items()) - if status["state"] == "measured" - ] - with open(os.environ["GITHUB_OUTPUT"], "a") as output: - output.write(f"measured={' '.join(measured)}\n") - - # Meta objects and raw tool logs must stay private: publish only the CSV. - name: Upload veristat results if: ${{ !cancelled() }} uses: actions/upload-artifact@v7 @@ -121,27 +102,22 @@ jobs: ${{ github.base_ref || github.ref_name }}-${{ env.ARCH_AND_TOOL }}-baseline-veristat-meta path: ${{ env.VERISTAT_BASELINE }} - - name: Compare with baseline - if: ${{ !cancelled() && github.event_name == 'pull_request' }} - env: - MEASURED: ${{ steps.state.outputs.measured }} + - name: Report veristat results + id: report + if: ${{ !cancelled() }} run: | - status=0 - for corpus in ${MEASURED}; do - echo "# ${corpus} corpus" | tee -a "${GITHUB_STEP_SUMMARY}" - BASELINE_PATH="${VERISTAT_BASELINE}/${corpus}.csv" \ - VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}.csv" \ - ./ci/veristat/compare-veristat-results.sh || status=1 - # A comparison table ends in without a newline; a blank - # line keeps the next corpus heading out of that HTML block. - printf '\n\n' >> "${GITHUB_STEP_SUMMARY}" - done - exit ${status} + args=() + if [[ '${{ github.event_name }}' == 'pull_request' ]]; then + args+=(--baseline "${VERISTAT_BASELINE}") + fi + python3 ci/veristat/veristat_compare.py \ + --config ci/veristat/meta.json --results "${VERISTAT_RESULTS}" \ + --veristat selftests/bpf/veristat "${args[@]}" - name: Stage veristat baseline - if: ${{ !cancelled() && github.event_name == 'push' && steps.state.outputs.measured }} + if: ${{ !cancelled() && github.event_name == 'push' && steps.report.outputs.measured }} env: - MEASURED: ${{ steps.state.outputs.measured }} + MEASURED: ${{ steps.report.outputs.measured }} run: | mkdir -p "${VERISTAT_BASELINE}" for corpus in ${MEASURED}; do @@ -149,7 +125,7 @@ jobs: done - name: Save veristat baseline - if: ${{ !cancelled() && github.event_name == 'push' && steps.state.outputs.measured }} + if: ${{ !cancelled() && github.event_name == 'push' && steps.report.outputs.measured }} uses: actions/cache/save@v5 with: key: ${{ github.ref_name }}-${{ env.ARCH_AND_TOOL }}-baseline-veristat-meta-${{ github.run_id }} diff --git a/.github/workflows/veristat-oss.yml b/.github/workflows/veristat-oss.yml index 696958f4..b1eef819 100644 --- a/.github/workflows/veristat-oss.yml +++ b/.github/workflows/veristat-oss.yml @@ -83,24 +83,6 @@ jobs: kernel-root: '.' # Compare and cache the measured corpora even if another one failed. - - name: Collect measured corpora - id: state - if: ${{ !cancelled() }} - shell: python3 {0} - run: | - import json, os - from pathlib import Path - - results = Path(os.environ["VERISTAT_RESULTS"]) - status_file = results / "status.json" - statuses = json.loads(status_file.read_text()) if status_file.exists() else {} - measured = [ - name for name, status in sorted(statuses.items()) - if status["state"] == "measured" - ] - with open(os.environ["GITHUB_OUTPUT"], "a") as output: - output.write(f"measured={' '.join(measured)}\n") - - name: Upload veristat results if: ${{ !cancelled() }} uses: actions/upload-artifact@v7 @@ -121,27 +103,22 @@ jobs: ${{ github.base_ref || github.ref_name }}-${{ env.ARCH_AND_TOOL }}-baseline-veristat-oss path: ${{ env.VERISTAT_BASELINE }} - - name: Compare with baseline - if: ${{ !cancelled() && github.event_name == 'pull_request' }} - env: - MEASURED: ${{ steps.state.outputs.measured }} + - name: Report veristat results + id: report + if: ${{ !cancelled() }} run: | - status=0 - for corpus in ${MEASURED}; do - echo "# ${corpus} corpus" | tee -a "${GITHUB_STEP_SUMMARY}" - BASELINE_PATH="${VERISTAT_BASELINE}/${corpus}.csv" \ - VERISTAT_OUTPUT="${VERISTAT_RESULTS}/${corpus}.csv" \ - ./ci/veristat/compare-veristat-results.sh || status=1 - # A comparison table ends in without a newline; a blank - # line keeps the next corpus heading out of that HTML block. - printf '\n\n' >> "${GITHUB_STEP_SUMMARY}" - done - exit ${status} + args=() + if [[ '${{ github.event_name }}' == 'pull_request' ]]; then + args+=(--baseline "${VERISTAT_BASELINE}") + fi + python3 ci/veristat/veristat_compare.py \ + --config ci/veristat/oss.json --results "${VERISTAT_RESULTS}" \ + --veristat selftests/bpf/veristat "${args[@]}" - name: Stage veristat baseline - if: ${{ !cancelled() && github.event_name == 'push' && steps.state.outputs.measured }} + if: ${{ !cancelled() && github.event_name == 'push' && steps.report.outputs.measured }} env: - MEASURED: ${{ steps.state.outputs.measured }} + MEASURED: ${{ steps.report.outputs.measured }} run: | mkdir -p "${VERISTAT_BASELINE}" for corpus in ${MEASURED}; do @@ -149,7 +126,7 @@ jobs: done - name: Save veristat baseline - if: ${{ !cancelled() && github.event_name == 'push' && steps.state.outputs.measured }} + if: ${{ !cancelled() && github.event_name == 'push' && steps.report.outputs.measured }} uses: actions/cache/save@v5 with: key: ${{ github.ref_name }}-${{ env.ARCH_AND_TOOL }}-baseline-veristat-oss-${{ github.run_id }} diff --git a/ci/veristat/README.md b/ci/veristat/README.md index 7b00014d..51f446bc 100644 --- a/ci/veristat/README.md +++ b/ci/veristat/README.md @@ -115,10 +115,20 @@ python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json \ --output manifest.json ``` -`compare-veristat-results.sh` compares a corpus CSV with its cached baseline -through `veristat --compare` and `veristat_compare.py`. It fails only when a -program that passed in the baseline now fails. Without a baseline, it prints -the results and passes. +`veristat_compare.py` reports all configured sources in one overview and pools +changed programs into one table with source labels. Failed/interrupted sources +and missing baselines remain visible. It uses `veristat --compare` per source; +verification regressions fail, and performance changes remain informational. +Without a baseline, a measured source is reported as such and passes. + +```sh +GITHUB_STEP_SUMMARY=summary.md python3 ci/veristat/veristat_compare.py \ + --config ci/veristat/oss.json --results veristat-results \ + --veristat selftests/bpf/veristat --baseline veristat-baseline +``` + +Omit `--baseline` for a measurement-only report. In GitHub Actions the report +outputs the measured sources through `GITHUB_OUTPUT`, for baseline staging. Each caller controls publication: OSS can share its debug bundle; Meta objects and raw logs must remain private. The OSS workflow uploads the whole results diff --git a/ci/veristat/compare-veristat-results.sh b/ci/veristat/compare-veristat-results.sh deleted file mode 100755 index 0c658ee9..00000000 --- a/ci/veristat/compare-veristat-results.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -veristat=$(realpath selftests/bpf/veristat) - -if [[ ! -f "${BASELINE_PATH}" ]]; then - echo "# No ${BASELINE_PATH} available" >> "${GITHUB_STEP_SUMMARY}" - - echo "No ${BASELINE_PATH} available" - echo "Printing veristat results" - cat "${VERISTAT_OUTPUT}" - - echo "$(basename "$0"): no baseline provided for veristat output" - echo "VERISTAT JOB PASSED" - exit 0 -fi - -cmp_out=$(mktemp veristate_compare_out_XXXXXX.csv) - -$veristat \ - --output-format csv \ - --emit file,prog,verdict,states \ - --compare "${BASELINE_PATH}" "${VERISTAT_OUTPUT}" > $cmp_out - -python3 ./ci/veristat/veristat_compare.py $cmp_out -exit_code=$? - -if [[ $exit_code -eq 0 ]]; then - echo "$(basename "$0"): veristat output matches the baseline" - echo "VERISTAT JOB PASSED" -else - echo "$(basename "$0"): veristat output does not match the baseline" - echo "VERISTAT JOB FAILED" -fi - -exit $exit_code diff --git a/ci/veristat/veristat_compare.py b/ci/veristat/veristat_compare.py index 85dc6f4f..0499c71b 100644 --- a/ci/veristat/veristat_compare.py +++ b/ci/veristat/veristat_compare.py @@ -1,54 +1,26 @@ #!/usr/bin/env python3 -# This script reads a CSV file produced by the following invocation: -# -# veristat --emit file,prog,verdict,states \ -# --output-format csv \ -# --compare ... -# -# And produces a markdown summary for the file. -# The summary is printed to standard output and appended to a file -# pointed to by GITHUB_STEP_SUMMARY variable. -# -# Script exits with return code 1 if there are new failures in the -# veristat results. -# -# For testing purposes invoke as follows: -# -# GITHUB_STEP_SUMMARY=/dev/null python3 veristat-compare.py test.csv -# -# File format (columns): -# 0. file_name -# 1. prog_name -# 2. verdict_base -# 3. verdict_comp -# 4. verdict_diff -# 5. total_states_base -# 6. total_states_comp -# 7. total_states_diff -# -# Records sample: -# file-a,a,success,failure,MISMATCH,12,12,+0 (+0.00%) -# file-b,b,success,success,MATCH,67,67,+0 (+0.00%) -# -# For better readability suffixes '_OLD' and '_NEW' -# are used instead of '_base' and '_comp' for variable -# names etc. +"""Report a batch of veristat results and compare its cached baselines.""" import io import os import sys import re import csv +import json import logging import argparse import enum from dataclasses import dataclass -from typing import Dict, Iterable, List, Final +from pathlib import Path +import subprocess +import tempfile +from typing import Dict, Iterable, List, Final, Optional TRESHOLD_PCT: Final[int] = 0 -SUMMARY_HEADERS = ["File", "Program", "Verdict", "States Diff (%)"] +SUMMARY_HEADERS = ["Source", "File", "Program", "Verdict", "States Diff (%)"] +OVERVIEW_HEADERS = ["Source", "Programs", "Passed", "Failed", "Status"] # expected format: +0 (+0.00%) / -0 (-0.00%) TOTAL_STATES_DIFF_REGEX = ( @@ -56,22 +28,6 @@ ) -TEXT_SUMMARY_TEMPLATE: Final[str] = """ -# {title} - -{table} -""".strip() - -HTML_SUMMARY_TEMPLATE: Final[str] = """ -# {title} - -
-Click to expand - -{table} -
-""".strip() - GITHUB_MARKUP_REPLACEMENTS: Final[Dict[str, str]] = { "->": "→", "(!!)": ":bangbang:", @@ -110,28 +66,15 @@ class VeristatInfo: changes: bool new_failures: bool - def get_results_title(self) -> str: - if self.new_failures: - return "There are new veristat failures" - - if self.changes: - return "There are changes in verification performance" - - return "No changes in verification performance" - - def get_results_summary(self, markup: bool = False) -> str: - title = self.get_results_title() - if not self.table: - return f"# {title}\n" - - template = TEXT_SUMMARY_TEMPLATE - table = format_table(headers=SUMMARY_HEADERS, rows=self.table) - if markup: - template = HTML_SUMMARY_TEMPLATE - table = github_markup_decorate(table) - - return template.format(title=title, table=table) +@dataclass +class SourceReport: + name: str + outcome: str + # A comparison error does not invalidate measured CSVs for baseline staging. + counts: Optional[List[str]] = None + comparison: Optional[VeristatInfo] = None + error: bool = False def get_state_diff(value: str) -> float: @@ -230,29 +173,155 @@ def format_table(headers: List[str], rows: List[List[str]]) -> str: return out.getvalue() -def main(compare_csv_filename: os.PathLike, output_filename: os.PathLike) -> None: - with open(compare_csv_filename, newline="", encoding="utf-8") as csv_file: - veristat_results = parse_table(csv_file) +def render_report(overview, changes, compared, markup=False): + report = "# Veristat\n\n" + format_table(OVERVIEW_HEADERS, overview) + if changes: + table = format_table(SUMMARY_HEADERS, changes) + if markup: + report += ( + "\n
\nChanged programs\n\n" + + github_markup_decorate(table) + + "\n
\n" + ) + else: + report += "\n" + table + elif compared: + report += "\nNo verification changes among compared programs.\n" + return report + "\n" - sys.stdout.write(veristat_results.get_results_summary()) - with open(output_filename, encoding="utf-8", mode="a") as file: - file.write(veristat_results.get_results_summary(markup=True)) +def compare_results(veristat, baseline, results): + with tempfile.TemporaryFile(mode="w+") as comparison: + subprocess.run( + [ + str(veristat.absolute()), + "--output-format", + "csv", + "--emit", + "file,prog,verdict,states", + "--compare", + str(baseline), + str(results), + ], + stdout=comparison, + check=True, + ) + comparison.seek(0) + return parse_table(comparison) - if veristat_results.new_failures: - return 1 - return 0 +def source_error(name, csv_path, error, counts=None): + print( + f"{name}: results/comparison error for {csv_path}: {type(error).__name__}: {error}", + file=sys.stderr, + ) + return SourceReport(name, "Error", counts, error=True) -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Print veristat comparison output as markdown step summary" +def summarize_source(name, status, results, baseline, veristat): + if status.get("state") != "measured": + outcome = {"running": "Interrupted", "error": "Measurement error"}.get( + status.get("state"), "Not run" + ) + if status.get("error"): + print( + f"{name}: {status['error']}; see {results / 'status.json'}", + file=sys.stderr, + ) + return SourceReport(name, outcome, error=True) + + csv_path = results / f"{name}.csv" + try: + with csv_path.open(newline="") as file: + records = list(csv.DictReader(file)) + if not records: + raise ValueError("no measured program records") + passed = sum(record["verdict"] == "success" for record in records) + counts = [str(len(records)), str(passed), str(len(records) - passed)] + except (OSError, ValueError, KeyError, csv.Error) as error: + return source_error(name, csv_path, error) + + if baseline is None: + return SourceReport(name, "Measured", counts) + baseline_path = baseline / f"{name}.csv" + try: + if not baseline_path.is_file(): + return SourceReport(name, "No baseline", counts) + comparison = compare_results(veristat, baseline_path, csv_path) + except ( + OSError, + ValueError, + KeyError, + csv.Error, + AssertionError, + subprocess.CalledProcessError, + ) as error: + return source_error(name, csv_path, error, counts) + return SourceReport(name, "Compared", counts, comparison) + + +def changed_rows(reports): + changes = [] + for report in reports: + if report.comparison is not None: + changes.extend([report.name] + row for row in report.comparison.table) + + changes.sort( + key=lambda row: ( + NEW_FAILURE_SUFFIX not in row[3], + -abs(float(row[4].removesuffix(" %"))), + row[:3], + ) ) - parser.add_argument("filename") + return changes + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--config", type=Path, required=True) + parser.add_argument("--results", type=Path, required=True) + parser.add_argument("--veristat", type=Path, required=True) + parser.add_argument("--baseline", type=Path) args = parser.parse_args() summary_filename = os.getenv("GITHUB_STEP_SUMMARY") if not summary_filename: logging.error("GITHUB_STEP_SUMMARY environment variable is not set") - sys.exit(1) - sys.exit(main(args.filename, summary_filename)) + return 1 + + status_file = args.results / "status.json" + statuses = json.loads(status_file.read_text()) if status_file.exists() else {} + reports = [ + summarize_source( + selection["name"], + statuses.get(selection["name"], {}), + args.results, + args.baseline, + args.veristat, + ) + for selection in json.loads(args.config.read_text()) + ] + overview = [ + [report.name, *(report.counts or ["-", "-", "-"]), report.outcome] + for report in reports + ] + changes = changed_rows(reports) + compared = sum(report.comparison is not None for report in reports) + sys.stdout.write(render_report(overview, changes, compared)) + with open(summary_filename, "a", encoding="utf-8") as file: + file.write("\n\n" + render_report(overview, changes, compared, markup=True)) + if output_filename := os.getenv("GITHUB_OUTPUT"): + measured = sorted( + report.name for report in reports if report.counts is not None + ) + with open(output_filename, "a", encoding="utf-8") as file: + file.write(f"measured={' '.join(measured)}\n") + return int( + any( + report.error or (report.comparison and report.comparison.new_failures) + for report in reports + ) + ) + + +if __name__ == "__main__": + sys.exit(main()) From 20119bb5872ffee713f4182540aa144614357ed0 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Mon, 16 Nov 2026 14:01:50 -0800 Subject: [PATCH 3/7] ci: document repository context and agent editing guidance The README lists BPF CI components but gives little guidance on editing injected workflows, result contracts or validation paths. Add agent instructions covering ownership, common failure modes and maintainer expectations. Point CLAUDE.md at that file and update the README with repository navigation and validation entry points. No functional change. Signed-off-by: Ihor Solodrai --- AGENTS.md | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + README.md | 75 +++++++++++++++++++++--------- 3 files changed, 188 insertions(+), 22 deletions(-) create mode 100644 AGENTS.md create mode 120000 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..b27173e7 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,134 @@ +# BPF CI workflows (vmtest) + +Repository context and expectations for changes to workflows, scripts and CI policy. +[README.md](README.md) provides the overview and validation entry points. +KPD also copies these files into kernel mirrors; this guidance covers the CI files, +while kernel changes follow the kernel's contribution rules. + +## What this repository owns + +This repository orchestrates BPF CI. KPD copies `.github` and top-level CI files +into kernel mirrors such as `kernel-patches/bpf`, where patch-series PRs and base +pushes run them. The default branch of `kernel-patches/vmtest` is `master`. + +| Path | Role | +|---|---| +| `.github/workflows/test.yml` | Entry point; matrix, build/test gates and concurrency | +| `.github/scripts/matrix.py` | Architectures, toolchains, runners and enabled workloads | +| `.github/workflows/kernel-{build,test,build-test}.yml` | Kernel/selftest artifacts, VM execution and workload fan-out | +| `.github/workflows/veristat-*.yml` | Corpus preparation, measurements, baselines and publication | +| `ci/veristat/` | Manifest/measurement/report CLIs and tests; see its README | +| `ci/vmtest/configs/` | Kernel configs, selftest filters and kernel-splat policy | +| `ci/diffs/` | Kernel patches applied before building; review applicability | +| `.github/workflows/linux-next-sync.yml` | Build linux-next from bpf_base plus upstream linux-next | +| `.github/workflows/ai-code-review.yml`, `ai-agent.yml`, `ci/claude/` | Automated review/investigation and publication | + +`libbpf/ci` owns reusable build actions and VM machinery. This repository owns +BPF CI corpus providers, filters, reporting/baseline policy and infrastructure +assumptions. Use action, command and file interfaces across repositories; do not +introduce a shared Python library for these scripts. Helpers stay within their component. + +## Easy to get wrong + +- **Caller context.** Reusable/injected workflows execute in other repositories. + `github.repository`, refs, permissions, secrets and workspace paths belong to the + run. Check caller and callee when changing inputs or conditions. +- **Validation paths.** A PR here downloads a kernel tree; production tests a kernel + mirror's revision. Some lint/agent jobs have repository-specific gates. Feature + pushes do not exercise the same paths as PRs or base pushes. +- **Independent gates.** Builds, selftests and veristat are separate workloads. Base + pushes can skip selftests while still measuring veristat and saving baselines. + Read the matrix and job/step conclusions; an overall failed run may have healthy + veristat jobs. A skipped job provides no coverage. +- **Artifact identity.** Match architecture/toolchain, kernel image, selftests and + modules across build/runtime jobs. Do not hardcode a lane accepted as an input. +- **Action versions.** `libbpf/ci@v4` is a moving tag; the downloaded SHA in a run log + is authoritative. Merging here propagates CI files through KPD. Updating an action + tag is a separate change affecting its callers. +- **linux-next.** Its separate sync starts from bpf_base and merges upstream linux-next. + Successful KPD base updates do not prove linux-next has synced. +- **Guest status.** `VMTEST_SCRIPT` selects a guest entrypoint. Preserve the action's + exitstatus-file contract so the host collects failures and artifacts. Inspect the + action before assuming guest paths, inherited environment or VM isolation. +- **Filters and splats.** Selftest deny lists, veristat filters and kernel-splat allow/ + deny lists serve different purposes. An allowed splat does not imply a test passed. + Explain exclusions and remove temporary workarounds once the underlying fix is available. + +## Veristat contracts + +Veristat tests various corpora of BPF programs through a shared measurement +and reporting pipeline. + +- Selection configs such as `oss.json` describe providers/globs/filters. Reserve + `manifest` for generated object paths and SHA256s. Object bytes define corpus + identity; source/compiler details are provenance. Corpus names must be unique in + a manifest and object basenames within a corpus; file/program keys are not globally unique. +- The worker writes source CSVs, shared diagnostics and an atomic source-status map. + `measured` means successful execution with valid nonempty results, not that every + program loaded. Missing/running receipts are unfinished; never cache partial output. +- Load failures are data and can mean verifier rejection, missing attach targets, + CO-RE or resource setup. Diagnose inputs/logs before blaming a kernel patch; zero + verifier states can indicate failure before verification. +- Current policy fails on matched `success -> failure`, reports state changes and + ignores wholly new/removed programs. Missing baselines pass with an explicit label. + Green does not prove every program was compared. Baseline selection currently uses + branch cache prefixes, not exact kernel/object matching; check provenance. +- Keep source errors visible when others succeed, retain regressions across later + comparisons, and stage baselines only for completed sources. +- Avoid manual source pins as a substitute for baseline correctness. Record actual + inputs and compare the same object bytes when attributing a regression. + +## Keep changes easy to understand + +Judge the whole flow the next maintainer must understand. Hidden assumptions, multiple +state writers, duplicated decisions, flags, fallbacks and aliases all add cost. Keep +ownership clear and derive values instead of maintaining parallel versions. Prefer +deletion and the smallest solution to the current requirement. A refactor must remove +an identifiable burden; moving code into helpers alone is not simplification. + +Keep control flow readable and outcomes distinct. Comments explain durable contracts +and non-obvious constraints at their source; verify claims and remove narration. +Diagnostics should identify the input/operation, cause and detailed evidence location +with few messages. + +## Tests and validation + +- Add script tests for plausible silent failures: green CI with missing, incorrect or + misreported results/artifacts. Protect output retention, not cosmetic console wording. + Let CI catch obvious command/syntax failures rather than build a large test harness. +- Prefer existing fixtures/tables and tests of CLIs, files, status and return codes. + Regression tests should fail without the fix. Pure refactors adapt existing tests; + avoid adding tests of private helpers. +- Validation evidence should cover the changed contract. Local VM checks can establish + execution behavior; GitHub runs cover workflow, permission, cache, artifact and backend + integration. Baseline bootstrap and failed-case propagation need evidence; passing + runs alone are insufficient. +- Validation results must correspond to the stated inputs, with matching kernel images, + modules, tools and objects. Record revisions, commands, scope and remaining limitations. + +`.github/workflows/lint.yml` defines the checks. These commands reproduce them +from a vmtest checkout; in a kernel mirror, checks apply to CI-owned files. + +```bash +python3 -m unittest ci/veristat/tests/*.py +black --check . +``` + +Changed scripts should pass `bash -n` and ShellCheck; CI uses +`--severity=warning --exclude=SC1091`. Workflow validation includes Actions expressions +and input-output wiring; YAML parsing alone is insufficient. Black follows `stable`, +so formatting checks need the same version when reproducing CI failures. + +## Reviewable changes + +- Prefer small commits with one logical change. Prerequisites should precede their + consumers, and renames/formatting should be separate from unrelated behavior changes. + Every prefix of a series should build and remain usable. Make cross-repository + dependencies and release requirements explicit. +- Commit messages should be concise, self-contained and explain the problem and rationale. + Follow existing component prefixes (e.g. `veristat:`, `ci:`, `ci/diffs:`), use imperative + subjects and wrap bodies for readability. Mark pure refactors `No functional change.` +- Sign-off and review tags represent human certifications and should reflect actual + authorship or review; do not fabricate them or add unsolicited AI attribution. +- Change descriptions should state what changed, the supporting validation and any + limitations. Distinguish observations from hypotheses. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 00000000..47dc3e3d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/README.md b/README.md index 81a0c1a6..5a973838 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,53 @@ -# BPF CI GitHub Actions worfklows - -This repository contains GitHub Actions workflow definitions, scripts and configuration files used by those workflows. - -You can check the workflow runs on [kernel-patches/bpf actions page](https://github.com/kernel-patches/bpf/actions/workflows/test.yml). - -**"BPF CI"** refers to a continuous integration testing system targeting [BPF subsystem of the Linux Kernel](https://ebpf.io/what-is-ebpf/). - -BPF CI consists of a number of components: -- [kernel-patches/bpf](https://github.com/kernel-patches/bpf) - a copy of Linux Kernel source repository tracking [upstream bpf trees](https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/) -- [Kernel Patches Daemon](https://github.com/kernel-patches/kernel-patches-daemon) instance - a service connecting [Patchwork](https://patchwork.kernel.org/project/netdevbpf/list/) with the GitHub repository -- [kernel-patches/vmtest](https://github.com/kernel-patches/vmtest) (this repository) - GitHub Actions workflows -- [libbpf/ci](https://github.com/libbpf/ci) - custom reusable GitHub Actions -- [kernel-patches/runner](https://github.com/kernel-patches/runner) - self-hosted GitHub Actions runners - -Of course BPF CI also has important dependencies such as: -- [selftests/bpf](https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf) - the main test suite of BPF CI -- [selftests/sched_ext](https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/sched_ext) - in-kernel sched_ext test suite -- [veristat](https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/veristat.c) - used to catch performance and BPF verification regressions on a suite of complex BPF programs -- [vmtest](https://github.com/danobi/vmtest) - a QEMU wrapper, used to execute tests in a VM -- [GCC BPF backend](https://gcc.gnu.org/wiki/BPFBackEnd) -- Above-mentioned [Patchwork](https://patchwork.kernel.org/) instance, maintained by the Linux Foundation +# BPF CI workflows + +This repository contains GitHub Actions workflows, scripts and test policy for +[Linux kernel BPF CI](https://github.com/kernel-patches/bpf/actions/workflows/test.yml). +It orchestrates kernel builds, BPF/sched_ext selftests, bpftool checks and veristat +comparisons. Kernel source and the reusable VM launcher live in other repositories. + +Kernel Patches Daemon (KPD) copies these CI files into kernel mirrors such as +`kernel-patches/bpf`, where patch-series PRs and base pushes execute them. PRs in +this repository validate changes using a downloaded kernel tree. The workflow +conditions and matrix determine which tests run in each context. + +## Navigate the repository + +| Path | Purpose | +|---|---| +| [.github/workflows](.github/workflows) | Entry points and reusable build/test/review workflows | +| [.github/scripts](.github/scripts) | Matrix generation, runner placement and workflow helpers | +| [ci/vmtest/configs](ci/vmtest/configs) | Kernel configs, selftest exclusions and kernel-splat policy | +| [ci/veristat](ci/veristat/README.md) | Corpus preparation, measurement and baseline reporting | +| [ci/diffs](ci/diffs) | Kernel patches applied before CI builds | +| [ci/claude](ci/claude/README.md) | AI review and investigation tooling | + +Agents should read [AGENTS.md](AGENTS.md) before editing. + +## Validate changes + +From the repository root, with Python 3 and Black installed: + +```bash +python3 -m unittest ci/veristat/tests/*.py +black --check . +``` + +Check changed shell scripts with Bash and the ShellCheck options in +[lint.yml](.github/workflows/lint.yml), and validate workflow syntax and wiring. +Changes to workflow execution, artifacts or baselines also need a GitHub Actions +run; feature-branch pushes alone do not exercise all PR/base-push paths. + +## BPF CI components + +- [kernel-patches/bpf](https://github.com/kernel-patches/bpf): kernel mirror tracking + [upstream BPF trees](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/). +- [KPD](https://github.com/kernel-patches/kernel-patches-daemon): connects + [Patchwork](https://patchwork.kernel.org/project/netdevbpf/list/) with GitHub, + reports CI results and sends notifications. +- [libbpf/ci](https://github.com/libbpf/ci): reusable build/test actions and VM setup. +- [kernel-patches/runner](https://github.com/kernel-patches/runner): runner images and setup. +- [danobi/vmtest](https://github.com/danobi/vmtest): QEMU-based VM launcher. + +The tested kernel supplies [BPF selftests and veristat](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf) +and [sched_ext selftests](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/sched_ext). +The [GCC BPF backend](https://gcc.gnu.org/wiki/BPFBackEnd) is tested separately. From c8ef6e14ddbb006ee9dee17654e3ed59b7a0ebe3 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Mon, 16 Nov 2026 11:25:48 -0800 Subject: [PATCH 4/7] veristat: cover pooled reports and shared diagnostics Pooling results can silently drop an earlier regression or replace diagnostics from one source with another's. A summary can also omit unmeasured sources while its measured subset looks healthy. Cover the CLI report with two sources sharing file/program names and check that regressions, later changes and unavailable sources survive. Verify that shared artifact logs retain both sources and raw stderr. Signed-off-by: Ihor Solodrai --- ci/veristat/tests/test_run_veristat.py | 21 ++++- ci/veristat/tests/test_veristat_compare.py | 93 ++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/ci/veristat/tests/test_run_veristat.py b/ci/veristat/tests/test_run_veristat.py index 70b843c4..c114a636 100644 --- a/ci/veristat/tests/test_run_veristat.py +++ b/ci/veristat/tests/test_run_veristat.py @@ -29,7 +29,11 @@ def setUp(self): ) def tool_output(self, command, stdout, stderr, **kwargs): - stdout.write(self.csv) + if "-o" in command: + stdout.write(self.csv) + stderr.write(b"tool detail \xff\n") + else: + stdout.write("verifier detail\n") return subprocess.CompletedProcess(command, 0) def invoke(self): @@ -58,6 +62,21 @@ def test_duplicate_corpus_does_not_pass(self): ) self.assertNotEqual(self.invoke(), 0) + def test_shared_diagnostics_retain_both_sources(self): + other = dict(self.corpus, name="other") + self.manifest.write_text( + json.dumps({"version": 1, "corpora": [self.corpus, other]}) + ) + self.assertEqual(self.invoke(), 0) + for filename, detail in ( + ("stderr.log", b"tool detail \xff"), + ("failures.log", b"verifier detail"), + ): + content = (self.results / filename).read_bytes() + self.assertEqual(content.count(detail), 2) + self.assertIn(b"# test\n", content) + self.assertIn(b"# other\n", content) + def test_completed_receipt_uses_object_basename(self): (self.root / "moved").mkdir() (self.root / "object.bpf.o").rename(self.root / "moved/object.bpf.o") diff --git a/ci/veristat/tests/test_veristat_compare.py b/ci/veristat/tests/test_veristat_compare.py index b65b6929..c50fd8b2 100644 --- a/ci/veristat/tests/test_veristat_compare.py +++ b/ci/veristat/tests/test_veristat_compare.py @@ -1,9 +1,19 @@ #!/usr/bin/env python3 +import contextlib +import io +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile import unittest +from unittest.mock import patch from typing import Iterable, List from ..veristat_compare import parse_table, VeristatFields +from .. import veristat_compare as report def gen_csv_table(records: Iterable[str]) -> List[str]: @@ -71,5 +81,88 @@ def test_parse_table_new_changes(self): self.assertFalse(veristat_info.new_failures) +class TestVeristatReport(unittest.TestCase): + def setUp(self): + temporary = tempfile.TemporaryDirectory() + self.addCleanup(temporary.cleanup) + self.root = Path(temporary.name) + self.results = self.root / "results" + self.baseline = self.root / "baseline" + self.results.mkdir() + self.baseline.mkdir() + self.config = self.root / "config.json" + self.config.write_text(json.dumps([{"name": "a"}, {"name": "b"}])) + self.statuses = {name: {"state": "measured"} for name in ("a", "b")} + header = "file_name,prog_name,verdict,total_states\n" + for name, verdict, states in (("a", "failure", 0), ("b", "success", 2)): + (self.results / f"{name}.csv").write_text( + header + f"same.bpf.o,prog,{verdict},{states}\n" + ) + (self.baseline / f"{name}.csv").write_text( + header + "same.bpf.o,prog,success,1\n" + ) + + def invoke(self): + (self.results / "status.json").write_text(json.dumps(self.statuses)) + + def compare(command, stdout, **kwargs): + record = ( + "same.bpf.o,prog,success,failure,MISMATCH,1,0,-1 (-100.00%)" + if Path(command[-1]).stem == "a" + else "same.bpf.o,prog,success,success,MATCH,1,2,+1 (+100.00%)" + ) + stdout.write("\n".join(gen_csv_table([record])) + "\n") + return subprocess.CompletedProcess(command, 0) + + args = [ + "report", + "--config", + str(self.config), + "--results", + str(self.results), + "--baseline", + str(self.baseline), + "--veristat", + "/usr/bin/true", + ] + with patch.object(sys, "argv", args), patch.dict( + os.environ, + GITHUB_STEP_SUMMARY=str(self.root / "summary.md"), + GITHUB_OUTPUT=str(self.root / "outputs"), + ), patch.object( + report.subprocess, "run", side_effect=compare + ), contextlib.redirect_stdout( + io.StringIO() + ) as output: + result = report.main() + return result, output.getvalue() + + def test_regression_and_later_source_both_reported(self): + result, text = self.invoke() + self.assertEqual(result, 1) + self.assertEqual(text.count("# Veristat"), 1) + self.assertRegex(text, r"\|a\s*\|same.bpf.o\s*\|prog\s*\|success -> failure") + self.assertRegex(text, r"\|b\s*\|same.bpf.o\s*\|prog\s*\|success") + self.assertLess(text.index("success -> failure"), text.index("+100.00 %")) + self.assertIn("measured=a b", (self.root / "outputs").read_text()) + + def test_missing_and_failed_sources_remain_visible(self): + self.config.write_text( + json.dumps([{"name": name} for name in ("a", "b", "failed", "missing")]) + ) + self.statuses["failed"] = {"state": "error", "error": "fixture failure"} + (self.baseline / "b.csv").unlink() + result, text = self.invoke() + self.assertEqual(result, 1) + for outcome in ("No baseline", "Measurement error", "Not run"): + self.assertIn(outcome, text) + + def test_empty_measured_results_do_not_pass(self): + (self.results / "a.csv").write_text("") + for file in self.baseline.iterdir(): + file.unlink() + self.assertEqual(self.invoke()[0], 1) + + if __name__ == "__main__": unittest.main() From 557ee57da44b5f945c3e3fd3473c59d386cf9cc7 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Fri, 13 Nov 2026 15:21:23 -0800 Subject: [PATCH 5/7] veristat: add wprof to the OSS corpus OSS veristat currently covers kernel, Cilium and SCX programs. Add wprof's tracing and stack-collection programs. Follow wprof's default branch to avoid maintaining a source pin. Build the linked main object and query object using only BPF targets, without the Rust application or symbolization libraries. Use the compiler and native dependencies already installed by the SCX action. Signed-off-by: Ihor Solodrai --- .github/workflows/veristat-oss.yml | 13 +++++++++++++ ci/veristat/README.md | 6 +++++- ci/veristat/build-wprof.sh | 9 +++++++++ ci/veristat/oss.json | 5 +++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 ci/veristat/build-wprof.sh diff --git a/.github/workflows/veristat-oss.yml b/.github/workflows/veristat-oss.yml index b1eef819..7a0642aa 100644 --- a/.github/workflows/veristat-oss.yml +++ b/.github/workflows/veristat-oss.yml @@ -68,6 +68,19 @@ jobs: with: output-dir: ${{ env.SCX_BUILD_OUTPUT }} + - name: Checkout wprof + uses: actions/checkout@v6 + with: + repository: anakryiko/wprof + path: wprof + submodules: recursive + + # The SCX action installs the compiler and libraries these builds require. + - name: Build wprof BPF programs + env: + CLANG: clang-${{ inputs.llvm_version }} + run: ./ci/veristat/build-wprof.sh wprof wprof-build-output/bpf + - name: Prepare veristat manifest run: python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json --output manifest.json diff --git a/ci/veristat/README.md b/ci/veristat/README.md index 51f446bc..036006c6 100644 --- a/ci/veristat/README.md +++ b/ci/veristat/README.md @@ -104,7 +104,7 @@ Selection configs for `create_manifest.py`: | File | Corpora | |---|---| -| `oss.json` | Kernel, Cilium, SCX | +| `oss.json` | Kernel, Cilium, SCX, wprof | | `meta.json` | Meta | After downloading/building the selected inputs, the workflows generate @@ -115,6 +115,10 @@ python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json \ --output manifest.json ``` +`build-wprof.sh ` builds wprof's BPF targets and copies +the linked `wprof-final.bpf.o` and `wprof_query.bpf.o` into the corpus directory. +The Rust application and symbolization libraries are not needed. + `veristat_compare.py` reports all configured sources in one overview and pools changed programs into one table with source labels. Failed/interrupted sources and missing baselines remain visible. It uses `veristat --compare` per source; diff --git a/ci/veristat/build-wprof.sh b/ci/veristat/build-wprof.sh new file mode 100755 index 00000000..59535673 --- /dev/null +++ b/ci/veristat/build-wprof.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -euo pipefail + +wprof=$1 +output=$2 + +make -C "$wprof/src" -j"$(nproc)" .output/wprof.skel.h .output/wprof_query.skel.h +mkdir -p "$output" +cp "$wprof/src/.output/wprof-final.bpf.o" "$wprof/src/.output/wprof_query.bpf.o" "$output/" diff --git a/ci/veristat/oss.json b/ci/veristat/oss.json index f3496522..c743dff8 100644 --- a/ci/veristat/oss.json +++ b/ci/veristat/oss.json @@ -14,5 +14,10 @@ "name": "scx", "directory": "scx-build-output/bpf", "pattern": "*.bpf.o" + }, + { + "name": "wprof", + "directory": "wprof-build-output/bpf", + "pattern": "*.bpf.o" } ] From 20c68d866d38670b35d07a10a3040a17f3567a92 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Fri, 13 Nov 2026 15:23:13 -0800 Subject: [PATCH 6/7] veristat: add retsnoop to the OSS corpus Retsnoop exercises function tracing and argument capture. Include its linked tracing, calibration and kernel-memory-reader objects alongside the other OSS workloads. Follow retsnoop's default branch and build only the BPF targets. Copy complete linked objects under .bpf.o names so the selection excludes intermediate files and simfail test objects, without building the Rust sidecar. Signed-off-by: Ihor Solodrai --- .github/workflows/veristat-oss.yml | 12 ++++++++++++ ci/veristat/README.md | 6 +++++- ci/veristat/build-retsnoop.sh | 12 ++++++++++++ ci/veristat/oss.json | 5 +++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 ci/veristat/build-retsnoop.sh diff --git a/.github/workflows/veristat-oss.yml b/.github/workflows/veristat-oss.yml index 7a0642aa..99dc04f1 100644 --- a/.github/workflows/veristat-oss.yml +++ b/.github/workflows/veristat-oss.yml @@ -81,6 +81,18 @@ jobs: CLANG: clang-${{ inputs.llvm_version }} run: ./ci/veristat/build-wprof.sh wprof wprof-build-output/bpf + - name: Checkout retsnoop + uses: actions/checkout@v6 + with: + repository: anakryiko/retsnoop + path: retsnoop + submodules: recursive + + - name: Build retsnoop BPF programs + env: + CLANG: clang-${{ inputs.llvm_version }} + run: ./ci/veristat/build-retsnoop.sh retsnoop retsnoop-build-output/bpf + - name: Prepare veristat manifest run: python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json --output manifest.json diff --git a/ci/veristat/README.md b/ci/veristat/README.md index 036006c6..3d0137ba 100644 --- a/ci/veristat/README.md +++ b/ci/veristat/README.md @@ -104,7 +104,7 @@ Selection configs for `create_manifest.py`: | File | Corpora | |---|---| -| `oss.json` | Kernel, Cilium, SCX, wprof | +| `oss.json` | Kernel, Cilium, SCX, wprof, retsnoop | | `meta.json` | Meta | After downloading/building the selected inputs, the workflows generate @@ -119,6 +119,10 @@ python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json \ the linked `wprof-final.bpf.o` and `wprof_query.bpf.o` into the corpus directory. The Rust application and symbolization libraries are not needed. +`build-retsnoop.sh ` builds the linked tracing, +calibration and kernel-memory-reader objects. It copies them under `.bpf.o` +names for corpus selection, leaving intermediate objects out. + `veristat_compare.py` reports all configured sources in one overview and pools changed programs into one table with source labels. Failed/interrupted sources and missing baselines remain visible. It uses `veristat --compare` per source; diff --git a/ci/veristat/build-retsnoop.sh b/ci/veristat/build-retsnoop.sh new file mode 100755 index 00000000..0b13f04e --- /dev/null +++ b/ci/veristat/build-retsnoop.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euo pipefail + +retsnoop=$1 +output=$2 + +make -C "$retsnoop/src" -j"$(nproc)" \ + .output/retsnoop.skel.h .output/calib_feat.skel.h .output/kmem_reader.skel.h +mkdir -p "$output" +for name in retsnoop calib_feat kmem_reader; do + cp "$retsnoop/src/.output/$name.bpfo" "$output/$name.bpf.o" +done diff --git a/ci/veristat/oss.json b/ci/veristat/oss.json index c743dff8..04dddeb6 100644 --- a/ci/veristat/oss.json +++ b/ci/veristat/oss.json @@ -19,5 +19,10 @@ "name": "wprof", "directory": "wprof-build-output/bpf", "pattern": "*.bpf.o" + }, + { + "name": "retsnoop", + "directory": "retsnoop-build-output/bpf", + "pattern": "*.bpf.o" } ] From b2e46cfdedd213a4a7b2b03379807493ba66f1a0 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Fri, 13 Nov 2026 15:23:14 -0800 Subject: [PATCH 7/7] veristat: add the blazesym BPF test object Blazesym's getpid test program exercises subprogram addresses and ring-buffer output. Include it in the OSS batch. Compile it from the blazesym submodule checked out with wprof, using that build's libbpf headers and x86 vmlinux types. No Rust build is needed. Signed-off-by: Ihor Solodrai --- .github/workflows/veristat-oss.yml | 5 +++++ ci/veristat/README.md | 6 +++++- ci/veristat/build-blazesym.sh | 10 ++++++++++ ci/veristat/oss.json | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 ci/veristat/build-blazesym.sh diff --git a/.github/workflows/veristat-oss.yml b/.github/workflows/veristat-oss.yml index 99dc04f1..71b23927 100644 --- a/.github/workflows/veristat-oss.yml +++ b/.github/workflows/veristat-oss.yml @@ -93,6 +93,11 @@ jobs: CLANG: clang-${{ inputs.llvm_version }} run: ./ci/veristat/build-retsnoop.sh retsnoop retsnoop-build-output/bpf + - name: Build blazesym BPF test program + env: + CLANG: clang-${{ inputs.llvm_version }} + run: ./ci/veristat/build-blazesym.sh wprof blazesym-build-output/bpf + - name: Prepare veristat manifest run: python3 ci/veristat/create_manifest.py --config ci/veristat/oss.json --output manifest.json diff --git a/ci/veristat/README.md b/ci/veristat/README.md index 3d0137ba..6a341eff 100644 --- a/ci/veristat/README.md +++ b/ci/veristat/README.md @@ -104,7 +104,7 @@ Selection configs for `create_manifest.py`: | File | Corpora | |---|---| -| `oss.json` | Kernel, Cilium, SCX, wprof, retsnoop | +| `oss.json` | Kernel, Cilium, SCX, wprof, retsnoop, blazesym | | `meta.json` | Meta | After downloading/building the selected inputs, the workflows generate @@ -123,6 +123,10 @@ The Rust application and symbolization libraries are not needed. calibration and kernel-memory-reader objects. It copies them under `.bpf.o` names for corpus selection, leaving intermediate objects out. +`build-blazesym.sh ` compiles blazesym's +`getpid.bpf.o` test program. It uses the blazesym submodule checked out with +wprof and the headers from its BPF build, in the x86_64 OSS lane. + `veristat_compare.py` reports all configured sources in one overview and pools changed programs into one table with source labels. Failed/interrupted sources and missing baselines remain visible. It uses `veristat --compare` per source; diff --git a/ci/veristat/build-blazesym.sh b/ci/veristat/build-blazesym.sh new file mode 100755 index 00000000..366c745a --- /dev/null +++ b/ci/veristat/build-blazesym.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -euo pipefail + +wprof=$1 +output=$2 + +mkdir -p "$output" +"${CLANG:-clang}" -g -O2 -target bpf -c -D__TARGET_ARCH_x86 \ + -I "$wprof/vmlinux.h/include/x86" -I "$wprof/src/.output" \ + "$wprof/blazesym/tests/bpf/src/getpid.bpf.c" -o "$output/getpid.bpf.o" diff --git a/ci/veristat/oss.json b/ci/veristat/oss.json index 04dddeb6..5c62b00f 100644 --- a/ci/veristat/oss.json +++ b/ci/veristat/oss.json @@ -24,5 +24,10 @@ "name": "retsnoop", "directory": "retsnoop-build-output/bpf", "pattern": "*.bpf.o" + }, + { + "name": "blazesym", + "directory": "blazesym-build-output/bpf", + "pattern": "*.bpf.o" } ]