Skip to content

Commit 4c15108

Browse files
committed
CI: Add smatch static analysis workflow
Smatch is an actively maintained kernel-aware static analyzer for C with a low false positive rate. Since the code checker can be run relatively quickly against the entire OpenZFS code base (15 min) it makes sense to add it as a GitHub Actions workflow. Today smatch reports a significant numbers warnings so the workflow is configured to always pass as long as the analysis was run. The results are available for reference. Long term it would ideal to resolve all of the errors/warnings at which point the workflow can be updated to fail when new problems are detected. ZFS-CI-Type: quick Signed-off-by: Brian Behlendorf <[email protected]>
1 parent 6015edb commit 4c15108

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/smatch.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: smatch
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
smatch:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout smatch
16+
uses: actions/checkout@v4
17+
with:
18+
repository: error27/smatch
19+
ref: master
20+
path: smatch
21+
- name: Install dependencies
22+
run: |
23+
sudo apt-get install -y llvm gcc make sqlite3 libsqlite3-dev libdbd-sqlite3-perl libssl-dev libtry-tiny-perl
24+
- name: Make
25+
run: |
26+
cd $GITHUB_WORKSPACE/smatch
27+
make -j$(nproc)
28+
- name: Checkout OpenZFS
29+
uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha }}
32+
path: zfs
33+
- name: Install dependencies
34+
run: |
35+
cd $GITHUB_WORKSPACE/zfs
36+
ONLY_DEPS=1 .github/workflows/scripts/qemu-3-deps-vm.sh ubuntu24
37+
- name: Autogen.sh
38+
run: |
39+
cd $GITHUB_WORKSPACE/zfs
40+
./autogen.sh
41+
- name: Configure
42+
run: |
43+
cd $GITHUB_WORKSPACE/zfs
44+
./configure --enable-debug
45+
- name: Make
46+
run: |
47+
cd $GITHUB_WORKSPACE/zfs
48+
make -j$(nproc) CHECK="$GITHUB_WORKSPACE/smatch/smatch" CC=$GITHUB_WORKSPACE/smatch/cgcc

0 commit comments

Comments
 (0)