checksrc: avoid extra runs in CI, enable more check locally, fix fallouts

To avoid redundant work in CI and to avoid a single checksrc issue make
all autotools jobs fail. After this patch checksrc issues make fail
the checksrc job, the `dist / verify-out-of-tree-autotools-debug`,
`dist / maketgz-and-verify-in-tree`  jobs and the fuzzer job (if run).
Of these, the `dist` jobs replicate local builds, also testing the build
logic.

Also add a script to check the complete local repository, optionally
with the build tree to verify generated C files.

Also:
- automatically run checksrc in subdirectories having a `checksrc`
  target. (examples, OS400, tests http/client, unit and tunit)
- tests/libtest: make sure to run `checksrc` on generated `lib1521.c`.
  (requires in-tree autotools build.)
- tests: run `checksrc` on targets also for non-`DEBUGBUILD`
  builds. It ensures to check `lib1521.c` in CI via job
  `dist / maketgz-and-verify-in-tree`.
- src: drop redundant `$(builddir)` in autotools builds.
- scripts: add `checksrc-all.sh` script to check all C sources and
  the build directory as an option.
- use the above from CI, also make it verify all generated sources.
- silence `checksrc` issues in generated C sources.
- checksrc: add `-v` option to enable verbose mode.
- checksrc: make verbose mode show checked filename and fix to only
  return error on failure.
- make sure that generated C files pass `checksrc`.

Assisted-by: Daniel Stenberg

Closes #17376
This commit is contained in:
Viktor Szakats 2025-05-17 02:02:23 +02:00
parent 414ec13840
commit e785e898a6
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
26 changed files with 119 additions and 25 deletions

View file

@ -41,7 +41,7 @@ jobs:
name: checkout
- name: check
run: git ls-files -z "*.[ch]" | xargs -0 -n1 ./scripts/checksrc.pl
run: scripts/checksrc-all.sh
codespell-cmakelint-pytype-ruff:
runs-on: ubuntu-latest

View file

@ -109,6 +109,8 @@ jobs:
make
make test-ci
make install
popd
scripts/checksrc-all.sh
verify-out-of-tree-cmake:
runs-on: ubuntu-latest

View file

@ -38,6 +38,7 @@ permissions: {}
env:
MAKEFLAGS: -j 5
CURL_CI: github
# handled in renovate.json
openssl-version: 3.5.0
# handled in renovate.json
@ -527,7 +528,6 @@ jobs:
- name: 'run pytest event based'
env:
CURL_TEST_EVENT: 1
CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'
PYTEST_XDIST_AUTO_NUM_WORKERS: 4
run: |

View file

@ -47,6 +47,7 @@ permissions: {}
env:
MAKEFLAGS: -j 5
CURL_CI: github
DEBIAN_FRONTEND: noninteractive
jobs:

View file

@ -37,6 +37,7 @@ permissions: {}
env:
MAKEFLAGS: -j 5
CURL_CI: github
CURL_CLANG_TIDYFLAGS: '-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-clang-analyzer-valist.Uninitialized'
# unhandled
bearssl-version: 0.6
@ -698,7 +699,6 @@ jobs:
- name: 'run pytest'
if: contains(matrix.build.install_steps, 'pytest')
env:
CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'
PYTEST_XDIST_AUTO_NUM_WORKERS: 4
run: |

View file

@ -47,6 +47,7 @@ permissions: {}
# newer than the 10.8 required by `CFURLCreateDataAndPropertiesFromResource`.
env:
CURL_CI: github
MAKEFLAGS: -j 4
LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
@ -338,7 +339,6 @@ jobs:
- name: 'run pytest'
if: ${{ !matrix.build.clang-tidy && contains(matrix.build.install_steps, 'pytest') }}
env:
CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'
PYTEST_XDIST_AUTO_NUM_WORKERS: 4
run: |

View file

@ -35,6 +35,9 @@ concurrency:
permissions: {}
env:
CURL_CI: github
jobs:
netbsd:
name: 'NetBSD, CM clang openssl ${{ matrix.arch }}'
@ -141,6 +144,7 @@ jobs:
architecture: ${{ matrix.arch }}
run: |
export MAKEFLAGS=-j3
export CURL_CI=github
# https://ports.freebsd.org/
time sudo pkg install -y autoconf automake libtool \
pkgconf brotli openldap26-client libidn2 libnghttp2 stunnel py311-impacket
@ -229,6 +233,7 @@ jobs:
set -e
ln -s /usr/bin/gcpp /usr/bin/cpp # Some tests expect `cpp`, which is named `gcpp` in this env.
export MAKEFLAGS=-j3
export CURL_CI=github
time autoreconf -fi
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
--prefix="${HOME}"/install \

View file

@ -35,6 +35,9 @@ concurrency:
permissions: {}
env:
CURL_CI: github
jobs:
cygwin:
name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"