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
make
make test-ci
make install
+ popd
+ scripts/checksrc-all.sh
verify-out-of-tree-cmake:
runs-on: ubuntu-latest
env:
MAKEFLAGS: -j 5
+ CURL_CI: github
# handled in renovate.json
openssl-version: 3.5.0
# handled in renovate.json
- name: 'run pytest event based'
env:
CURL_TEST_EVENT: 1
- CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'
PYTEST_XDIST_AUTO_NUM_WORKERS: 4
run: |
env:
MAKEFLAGS: -j 5
+ CURL_CI: github
DEBIAN_FRONTEND: noninteractive
jobs:
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
- 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: |
# 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
- 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: |
permissions: {}
+env:
+ CURL_CI: github
+
jobs:
netbsd:
name: 'NetBSD, CM clang openssl ${{ matrix.arch }}'
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
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 \
permissions: {}
+env:
+ CURL_CI: github
+
jobs:
cygwin:
name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"
AC_CONFIG_SRCDIR([lib/urldata.h])
AC_CONFIG_HEADERS(lib/curl_config.h)
+AH_TOP([/* !checksrc! disable COPYRIGHT all */])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
LT_LANG([Windows Resource])
+AM_CONDITIONAL(NOT_CURL_CI, test -z "$CURL_CI")
+
#
# Automake conditionals based on libtool related checks
#
PEM/DER support:
-OpenSSL and GnuTLS (added in 7.39.0), wolfSSL (added in 7.43.0), mbedTLS
-(added in 7.47.0), Secure Transport macOS 10.7+/iOS 10+ (added in 7.54.1),
+OpenSSL and GnuTLS (added in 7.39.0), wolfSSL (added in 7.43.0),
+mbedTLS (added in 7.47.0),
+Secure Transport macOS 10.7+/iOS 10+ (added in 7.54.1),
Schannel (added in 7.58.1)
sha256 support:
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) $(srcdir)/*.c)
+
+if NOT_CURL_CI
+if DEBUGBUILD
+# for debug builds, we scan the sources on all regular make invokes
+all-local: checksrc
+endif
+endif
checksrc:
$(CHECKSRC)@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
+if NOT_CURL_CI
if DEBUGBUILD
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
+endif
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
$(CSOURCES) $(HHEADERS))
+if NOT_CURL_CI
if DEBUGBUILD
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
+endif
# disable the tests that are mostly causing false positives
TIDYFLAGS := -checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -quiet
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) $(srcdir)/OS400/*.[ch])
+
+if NOT_CURL_CI
+if DEBUGBUILD
+# for debug builds, we scan the sources on all regular make invokes
+all-local: checksrc
+endif
+endif
#
###########################################################################
-EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \
- mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
- dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck \
+EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-all.sh \
+ mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
+ dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck \
CMakeLists.txt pythonlint.sh randdisable wcurl
dist_bin_SCRIPTS = wcurl
--- /dev/null
+#!/bin/sh
+# Copyright (C) Viktor Szakats
+#
+# SPDX-License-Identifier: curl
+
+set -eu
+
+anyfailed=0
+
+for dir in $({
+ if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
+ git ls-files '*.[ch]'
+ else
+ find . -name '*.[ch]'
+ fi
+ [ -n "${1:-}" ] && find "$@" -name '*.[ch]'
+ } | grep -v -F '/CMakeFiles/' | sed -E 's|/[^/]+$||' | sort -u); do
+ if ! ./scripts/checksrc.pl "${dir}"/*.[ch]; then
+ anyfailed=1
+ fi
+done
+
+exit "${anyfailed}"
my $wlist="";
my @alist;
my $windows_os = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
-my $verbose;
+my $verbose = 0;
my %skiplist;
my %ignore;
$file = shift @ARGV;
next;
}
+ elsif($file =~ /^-v/) {
+ $verbose = 1;
+ $file = shift @ARGV;
+ next;
+ }
elsif($file =~ /^(-h|--help)/) {
undef $file;
last;
print " -W[file] Skip the given file - ignore all its flaws\n";
print " -i<n> Indent spaces. Default: 2\n";
print " -m<n> Maximum line length. Default: 79\n";
+ print " -v Verbose\n";
print "\nDetects and warns for these problems:\n";
my @allw = keys %warnings;
push @allw, keys %warnings_extended;
my $l = "";
my $prep = 0;
my $prevp = 0;
+
+ if($verbose) {
+ printf "Checking file: $file\n";
+ }
+
open(my $R, '<', $file) || die "failed to open $file";
my $incomment=0;
$serrors,
$swarnings;
}
- exit 5; # return failure
+ if($errors || $warnings) {
+ exit 5; # return failure
+ }
}
add_custom_command(
OUTPUT "tool_hugehelp.c"
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > "tool_hugehelp.c"
+ COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable COPYRIGHT all */" >> "tool_hugehelp.c"
+ COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable INCLUDEDUP all */" >> "tool_hugehelp.c"
+ COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable LONGLINE all */" >> "tool_hugehelp.c"
COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> "tool_hugehelp.c"
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" < "${CURL_ASCIIPAGE}" >> "tool_hugehelp.c"
COMMAND ${CMAKE_COMMAND} -E echo "#else" >> "tool_hugehelp.c"
# Use absolute directory to disable VPATH
ASCIIPAGE=$(top_builddir)/docs/cmdline-opts/curl.txt
MKHELP=$(top_srcdir)/src/mkhelp.pl
-HUGE=$(builddir)/tool_hugehelp.c
+HUGE=tool_hugehelp.c
HUGECMD = $(HUGEIT_$(V))
HUGEIT_0 = @echo " HUGE " $@;
# This generates the tool_hugehelp.c file in both uncompressed and
# compressed formats.
$(HUGE): $(ASCIIPAGE) $(MKHELP)
- $(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE); \
- echo '#ifndef HAVE_LIBZ' >> $(HUGE); \
- $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \
- echo '#else' >> $(HUGE); \
- $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \
+ $(HUGECMD)( \
+ echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \
+ echo '/* !checksrc! disable INCLUDEDUP all */' >> $(HUGE); \
+ echo '/* !checksrc! disable LONGLINE all */' >> $(HUGE); \
+ echo '#include "tool_setup.h"' >> $(HUGE); \
+ echo '#ifndef HAVE_LIBZ' >> $(HUGE); \
+ $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \
+ echo '#else' >> $(HUGE); \
+ $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \
echo '#endif /* HAVE_LIBZ */' >> $(HUGE) )
else # HAVE_LIBZ
# This generates the tool_hugehelp.c file uncompressed only
$(HUGE): $(ASCIIPAGE) $(MKHELP)
- $(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE); \
+ $(HUGECMD)( \
+ echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \
+ echo '#include "tool_setup.h"' >> $(HUGE); \
$(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) )
endif
else # USE_MANUAL
# built-in manual has been disabled, make a blank file
$(HUGE):
+ echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \
echo '#include "tool_hugehelp.h"' >> $(HUGE)
endif
curl_hfiles_gen += tool_hugehelp.h
CLEANFILES += $(HUGE)
-CA_EMBED_CSOURCE = $(builddir)/tool_ca_embed.c
+CA_EMBED_CSOURCE = tool_ca_embed.c
curl_cfiles_gen += $(CA_EMBED_CSOURCE)
CLEANFILES += $(CA_EMBED_CSOURCE)
if CURL_CA_EMBED_SET
$(PERL) $(MK_FILE_EMBED) --var curl_ca_embed < $(CURL_CA_EMBED) > $(CA_EMBED_CSOURCE)
else
$(CA_EMBED_CSOURCE):
- echo 'extern const void *curl_ca_embed; const void *curl_ca_embed;' > $(CA_EMBED_CSOURCE)
+ echo '/* !checksrc! disable COPYRIGHT all */' > $(CA_EMBED_CSOURCE)
+ echo 'extern const void *curl_ca_embed; const void *curl_ca_embed;' >> $(CA_EMBED_CSOURCE)
endif
CHECKSRC = $(CS_$(V))
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) $(CURL_CFILES) $(CURL_HFILES))
+if NOT_CURL_CI
if DEBUGBUILD
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
+endif
# disable the tests that are mostly causing false positives
TIDYFLAGS := -checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -quiet
/*
* NEVER EVER edit this manually, fix the mk-file-embed.pl script instead!
*/
+/* !checksrc! disable COPYRIGHT all */
#ifndef CURL_DECLARED_${varname_upper}
#define CURL_DECLARED_${varname_upper}
extern const unsigned char ${varname}[];
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) $(srcdir)/*.c)
+
+if NOT_CURL_CI
+all-local: checksrc
+endif
CS_ = $(CS_0)
# ignore generated C files since they play by slightly different rules!
-checksrc:
+checksrc: lib1521.c
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
-W$(srcdir)/libtest_bundle.c \
$(srcdir)/*.[ch])
-if DEBUGBUILD
-# for debug builds, we scan the sources on all regular make invokes
+if NOT_CURL_CI
all-local: checksrc
endif
print <<HEADER
/* !checksrc! disable COPYRIGHT all */
/* !checksrc! disable INCLUDEDUP all */
+/* !checksrc! disable UNUSEDIGNORE all */
#define CURLTESTS_BUNDLED
#define CURLTESTS_BUNDLED_TEST_H
-W$(srcdir)/server_bundle.c \
$(srcdir)/*.[ch])
-if DEBUGBUILD
-# for debug builds, we scan the sources on all regular make invokes
+if NOT_CURL_CI
all-local: checksrc
endif
-W$(srcdir)/tool_bundle.c \
$(srcdir)/*.[ch])
+if NOT_CURL_CI
+all-local: checksrc
+endif
+
clean-local:
rm -f $(BUNDLE)
-W$(srcdir)/unit_bundle.c \
$(srcdir)/*.[ch])
+if NOT_CURL_CI
+all-local: checksrc
+endif
+
clean-local:
rm -f $(BUNDLE)