Commit Graph
14 Commits
Author SHA1 Message Date
Gleb Chesnokov dfcd25997e scripts: Keep analyzer stdin flowing during progress updates
A progress timeout can occur before the child consumes all supplied
input. On Python 3.12, retrying communicate() without input stops
scheduling writes to stdin. The child waits for EOF while the driver
keeps waiting for output, which can hang the analyzer script tests
until the CI job timeout.

Run communicate() once in an I/O worker while the main thread waits
for its result and updates progress. On interruption, stop the owned
process group before joining the worker so blocked pipes cannot
prevent cleanup.

Make the regression wait for two progress updates before reading stdin
to force the pending-input case. Bound the entire child with an alarm
so a regression reports a failure instead of hanging the suite.

Validation: reproduce both check modes failing on Python 3.12.14
before the fix; all 75 lint-test fixtures pass on chesnokov-vm2
afterwards. All 11 process/log fixtures also pass locally on Python
3.14.8.

Fixes: c8648f9410 ("scripts: Share analyzer process and raw-log handling")
2026-10-20 15:48:45 +03:00
Gleb Chesnokov 78d97a1c30 .github/workflows: Run Checkpatch and SCST style analysis
Add a parallel make checkpatch job for pushes to master and manual
runs. Fail analyzer jobs on remaining source findings with status 1;
keep tool, build and coverage failures separate with status 2.
Validate the current report, Make status and native coverage before
classifying results. Checkpatch needs its script and data, not a
prepared KUnit kernel. Update the isolated CI report fixtures.

Run SCST style fixtures and make scs_lint in a separate job without a
kernel build, alongside the native analyzers. Pin uv and its setup
action; the linter supplies its pinned parser dependencies.

Retain the pull-request Checkpatch workflow for patch and commit
checks. Remove the standalone push Checkpatch workflow, whose role
is now covered by the common static-analyzer workflow.

Rename Tooling to Analyzer script tests and clarify that analyzer
jobs include KUnit sources without executing KUnit. Update Checkout
and Upload Artifact to v7 to replace their deprecated Node.js 20
runtimes, and align the CI documentation with the actual jobs.
2026-10-20 14:16:08 +03:00
Gleb Chesnokov 74a2e4bac3 scripts: Add the SCST code style linter
Document SCS.1 and expose make scs_lint for the common C source/header
scope, including userspace and KUnit. Adapt engine's OCS.7.5 check to
SCST_KUNIT_VISIBLE, SCST_KUNIT_VISIBLE_INLINE and VISIBLE_IF_KUNIT.
Require each annotation to occupy its own line; leave other function
attributes and source warnings unchanged.

Use Tree-sitter to distinguish code from comments, literals and
preprocessor directive contents while checking every conditional
branch. Pin the parser dependencies and run them through uv.

Support whole-tree, DIFFBR and explicit-file selection without new
exclusions or diagnostic exceptions. Retain findings and checked-file
records even when a later input fails. Add isolated rule, diff-mode,
coverage and read-failure fixtures with a separate test target.
2026-10-20 14:16:08 +03:00
Gleb Chesnokov 704c44dabe scripts: Add whole-file Checkpatch analysis
Expose make checkpatch through the common C source/header policy,
including userspace and KUnit sources. DIFFBR selects whole changed
files. Use the kernel's Checkpatch and companion data with --strict,
without adding diagnostic exceptions or loading local configuration.

Retain raw output and require native totals and a completion record
for every selected file. Distinguish source findings from unreadable
inputs, inconsistent reports and tool failures, with isolated fixtures.
Keep native caches in a temporary directory and serialize only this
analyzer's reports so it can run alongside the Kbuild analyzers.

Make checkpatch_scan use this target's implementation and exit status
instead of suppressing errors. Preserve the separate existing policy
of patch/commit helpers and the kernel regression runner.
2026-10-20 14:16:08 +03:00
Gleb Chesnokov 0c5a41bba8 .github/workflows: Run Sparse and Smatch with KUnit
Run isolated tooling checks and separate Sparse and Smatch Make targets
on pushes to master and manual dispatch. Use the pinned kernel with
KUnit enabled and preserve full logs, policy and tool provenance.

During the source-fix rollout, completed source findings are advisory.
Tool, build, parser and coverage failures remain blocking, including an
empty scan or missing KUnit inputs. Local Make targets stay strict.
Validate the current run's report together with Make's exit status,
since Make maps both findings and incomplete analysis to status 2.

Prepare the runner and container for Coccinelle and Cppcheck as well,
but leave their matrix entries commented out. Cover all four report
formats and GNU Make exit mapping with isolated tooling fixtures.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov 6c3405f5fe scripts: Add Cppcheck with native build contexts
Expose make cppcheck using freshly captured kernel CHECK commands and
real userspace compiler invocations. Keep their include paths and
definitions unchanged and analyze kernel and userspace contexts
separately.

Use the shared source scope without additional input exclusions, project
models or diagnostic suppressions. Relevant diffs trigger full
configured analysis; KUnit coverage follows the actual build
configuration.

Retain build logs, compilation databases, native XML and checker
coverage. Separate source findings from parser failures, missing inputs
and incomplete builds, with isolated report and capture fixtures.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov 4b56975115 scripts: Add native Coccinelle report analysis
Expose make coccicheck using report rules from the selected kernel and
the shared source policy, including userspace and KUnit sources. Diff
mode selects whole changed sources and headers.

Preserve full native output and record rule initialization, per-input
handling and finalization. Treat parser errors and missing coverage as
incomplete analysis even if spatch returns zero; report source findings
separately.

Add isolated log and policy fixtures. Do not introduce project macro
models, diagnostic exceptions or CI execution.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov 2f8ff7ea63 scripts: Integrate Sparse and Smatch with reviewed policy
Run the native checkers through the ordered SCST module build with C=2.
Preserve Kbuild flags, full raw output and every attempted CHECK record.
Keep full, diff and explicit input selection on the shared scope; diff
selection triggers the complete configured module analysis.

Read exact diagnostic exceptions from policy/sparse.json and
smatch.json: two reviewed Smatch IRQ reports and the external FC
flexible-array warning. Keep the existing SCST matching boundaries and
reasons. Smatch uses its matching installed kernel data without
engine-specific additions.

Reject build, checker, frontend and truncation failures even when Kbuild
returns success. Retain per-invocation records and a machine-readable
run summary, and detect printed CHECK steps without a record. Require
selected C inputs to occur in the build. Keep findings distinct from
incompleteness.

Check native compatibility before compilation, and forward external
kernel capability probes to the real checker instead of skipping them as
inputs outside SCST. Include the pinned Smatch typeof frontend
correction and isolated fixtures for failure propagation and exact
exception boundaries.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov df16b2e697 scripts: Expose analyzer policy without running tools
Add show, files and validate commands to analyzer_policy.py and expose
policy inspection through make analyzer-policy. Support text and JSON
reports without installing or invoking an analyzer or preparing a build.

Show the configured roots, input exclusions and their reasons. The file
inventory uses the shared selector and reports eligible tracked inputs,
not completed analysis or build coverage. Configuration and Git failures
return an error instead of a successful empty report.

Expose only the common input policy at this stage. Individual analyzer
policies belong with their drivers. Keep the existing checkpatch and
kernel regression filtering separate and document that boundary.

Add isolated CLI fixtures for policy reporting, repository-relative input
inventory and visible failures. Document the inspection entry points.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov c1e2f41a49 scripts: Store shared analyzer scope as reviewed policy
Move the source roots, file types and input exclusions from lint_scope.py
into policy/common.json. Keep the existing scope, including KUnit sources,
the newer QLogic target and the exclusions for the legacy QLogic tree,
upstream QLogic sources, compiler probes and generated module metadata.

Adapt engine's reviewed-data and strict-loader approach to SCST. Require
reasons for input exclusions and reject malformed, missing or ambiguous
policy before selecting files. Do not import engine's exclusions or add
environment-based filtering or diagnostic suppression.

Use this policy for full, diff and explicit-file selection. Preserve both
lexical and resolved path checks, single-commit diff bases and index-based
selection. Treat policy paths literally in Git pathspecs as well as Python.
Add isolated fixtures for schema failures and policy-driven selection.
2026-10-19 21:38:56 +03:00
Gleb Chesnokov 05502f10b2 scripts: Share the analyzer build lock
Extract the per-worktree build lock ahead of the Sparse/Smatch and
Cppcheck drivers. Keep one advisory lock file for analyzer builds that
share generated state; release the descriptor on success or exception
without unlinking the file.

Document that callers must hold the lock around build-state changes and
log reset, and that ordinary builds are not covered by this advisory lock.
Add isolated fixtures checking cross-process contention, lock reuse and
release after an exception. Kbuild collection and analyzer-specific build
targets remain with their respective integration series.
2026-10-19 19:18:14 +03:00
Gleb Chesnokov c8648f9410 scripts: Share analyzer process and raw-log handling
Provide common process, progress and report helpers for the upcoming
analyzer drivers. Preserve raw output bytes and command failure statuses,
keep progress separate from captured diagnostics, and terminate the owned
process group when an invocation is interrupted.

Forward valid inherited Make jobserver pipes without taking their tokens.
Document named-log truncation explicitly: a later run replaces that named
report unless the caller requests preservation.

Import the process and terminal fixtures and add raw-log coverage. No
analyzer-specific filtering or diagnostic exclusions are introduced.
2026-10-19 19:18:14 +03:00
Gleb Chesnokov 1c455d4785 scripts: Validate analyzer diff bases as single commits
Passing the base directly to git diff allows an option such as --quiet to
be interpreted as a flag. On a clean worktree it can succeed without
selecting any sources, instead of rejecting the invalid revision.

Resolve the base with rev-parse --verify --end-of-options and require a
commit before building the diff command. Reuse the resulting object ID so
options, ranges, tree objects and unknown revisions cannot turn an invalid
request into an empty selection.

Add a fixture covering rejected bases on a clean tree and a valid tag
before and after a source change. Expose the resolver for future patch
consumers as well.
2026-10-19 19:18:14 +03:00
Gleb Chesnokov fce9b872b0 scripts: Define shared analyzer source selection
Give the upcoming analyzer drivers one source-selection policy for full,
working-tree diff and explicit-file checks. Include product C sources and
headers, including KUnit, and keep both lexical and resolved paths within
the allowed directories.

Select only the newer QLogic SCST target directory. Exclude the legacy
QLogic tree, the upstream part of the newer driver, the two conftest trees
and generated .mod.c files. Document these input exclusions separately
from diagnostic filtering, which this helper does not perform.

Add temporary-repository fixtures and a make lint-test entry point. Keep
the existing checkpatch and kernel regression consumers unchanged until
their replacement drivers are introduced.
2026-10-19 19:18:14 +03:00