diff options
author | NRK <nrk@disroot.org> | 2023-06-15 17:25:54 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2023-06-15 17:25:54 +0200 |
commit | 28018e92d3e2fa47d58a216bab489cbd81d8e974 (patch) | |
tree | 4fdc6076f24c59b6ea44387cdd1f93979eca0129 /etc/woodpecker/analysis.sh | |
parent | c03ec39437b473526080f496d6c8564e98bea1d7 (diff) | |
download | nsxiv-28018e92d3e2fa47d58a216bab489cbd81d8e974.tar.zst |
CI: misc cleanups + faster analysis (#449)
* switch to git ls-files to avoid picking up any other local .c files
* enable assertions during static analysis since we used some assertions to
disable/silence certain warnings.
* update TCC commit hash to a more recent one
* parallelize static analysis
cppcheck already has -j argument to parallelize it's analysis and
provide results faster, clang-tidy unfortunately doesn't.
so use xargs -P to archive parallel execution. on my system this brings
down the analysis time from ~27s to ~5s.
Diffstat (limited to 'etc/woodpecker/analysis.sh')
-rwxr-xr-x | etc/woodpecker/analysis.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/woodpecker/analysis.sh b/etc/woodpecker/analysis.sh index 330d140..5a227ce 100755 --- a/etc/woodpecker/analysis.sh +++ b/etc/woodpecker/analysis.sh @@ -1,21 +1,24 @@ #!/bin/sh -e std="c99" +NProc=$(( $(nproc) / 4 )) +if [ -z "$NProc" ] || [ "$NProc" -lt 1 ]; then NProc="1"; fi run_cppcheck() { cppcheck --std="$std" --enable=performance,portability \ --force --quiet --inline-suppr --error-exitcode=1 \ - --max-ctu-depth=8 -j"$(nproc)" \ - $(make OPT_DEP_DEFAULT="$1" dump_cppflags) \ + --max-ctu-depth=8 -j"$NProc" \ + $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG \ --suppress=varFuncNullUB --suppress=uninitvar \ - *.c + $(git ls-files *.c) } run_tidy() { checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)" - clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \ - -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) + git ls-files *.c | xargs -P"$NProc" -I{} clang-tidy --quiet \ + --warnings-as-errors="*" --checks="$checks" {} \ + -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG } -run_cppcheck "0"; run_cppcheck "1"; -run_tidy "0"; run_tidy "1"; +run_cppcheck "0" & run_cppcheck "1" & run_tidy "0" & run_tidy "1"; +wait |