1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00

checksrc: extend to ossfuzz, reduce scope of exceptions

Replace a few calls in tests to reduce exceptions.

Closes #1998
This commit is contained in:
Viktor Szakats
2026-06-08 15:50:45 +02:00
parent 124c68bbed
commit 509eac8b96
15 changed files with 49 additions and 24 deletions

View File

@@ -13,40 +13,28 @@ use Cwd 'abs_path';
my @options = (
"-i4", "-m79",
"-AFIXME", "-AERRNOVAR",
"-aaccept",
"-aatoi",
"-acalloc",
"-aclose",
"-aCreateFileA",
"-afclose",
"-afopen",
"-afree",
"-afstat",
"-amalloc",
"-aprintf",
"-arealloc",
"-arecv",
"-asend",
"-asnprintf",
"-asocket",
"-asocketpair",
"-astrdup",
"-astrtok",
"-astrtol",
"-avsnprintf",
);
my @files;
my $is_git = 0;
if(system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') == 0) {
open(O, '-|', 'git', 'ls-files', '*.[ch]') || die; push @files, <O>; close(O);
open(O, '-|', 'git', 'ls-files', '*.[ch]', '*.cc') || die; push @files, <O>; close(O);
$is_git = 1;
}
else {
find(sub { if(/\.[ch]$/) { push(@files, $File::Find::name) } }, ('.'));
find(sub { if(/\.([ch]|cc)$/) { push(@files, $File::Find::name) } }, ('.'));
}
if(@ARGV) {
find(sub { if(/\.[ch]$/) { push(@files, $File::Find::name) } }, @ARGV);
find(sub { if(/\.([ch]|cc)$/) { push(@files, $File::Find::name) } }, @ARGV);
}
@files = grep !/\/CMakeFiles\//, @files;
@@ -59,11 +47,11 @@ my $anyfailed = 0;
for my $dir (@dirs) {
if($is_git) {
@files = ();
open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") || die; push @files, <O>; close(O);
open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]", ":(glob)$dir/*.cc") || die; push @files, <O>; close(O);
chomp(@files);
}
else {
@files = glob("$dir/*.[ch]");
@files = glob("$dir/*.[ch] $dir/*.cc");
}
if(@files && system("$scripts_dir/checksrc.pl", @options, @files) != 0) {
$anyfailed = 1;