tests: ensure libcurl.def contains all exports

Add `test1279` to verify that `libcurl.def` lists all exported API
functions found in libcurl headers.

Also:

- extend test suite XML `stdout` tag with the `loadfile` attribute.

- fix `tests/extern-scan.pl` and `test1135` to include websocket API.

- use all headers (sorted) in `test1135` instead of a manual list.

- add options `--sort`, `--heading=` to `tests/extern-scan.pl`.

- add `libcurl.def` to the auto-labeler GHA task.

Follow-up to 2ebc74c36a

Closes #11570
This commit is contained in:
Viktor Szakats 2023-08-01 22:02:43 +00:00
parent d135d040df
commit db70846e2e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 187 additions and 109 deletions

View file

@ -28,18 +28,41 @@
use strict;
use warnings;
# we may get the dir root pointed out
my $root=$ARGV[0] || ".";
my $sort = 0;
my @incs = (
"$root/include/curl/curl.h",
"$root/include/curl/easy.h",
"$root/include/curl/mprintf.h",
"$root/include/curl/multi.h",
"$root/include/curl/urlapi.h",
"$root/include/curl/options.h",
"$root/include/curl/header.h",
);
# we may get the dir root pointed out
my $root = shift @ARGV;
while(defined $root) {
if($root =~ /--heading=(.*)/) {
print "$1\n";
$root = shift @ARGV;
next;
}
elsif($root =~ /--sort/) {
$sort = 1;
$root = shift @ARGV;
next;
}
last;
}
if(!defined $root) {
$root = ".";
}
$root = "$root/include/curl";
opendir(D, "$root") || die "Cannot open directory $root: $!\n";
my @dir = readdir(D);
closedir(D);
my @incs;
foreach (sort(@dir)) {
if($_ =~ /\.h$/) {
push(@incs, "$root/$_");
}
}
my $verbose=0;
my $summary=0;
@ -49,8 +72,8 @@ my @syms;
my %doc;
my %rem;
sub scanheader {
my ($f)=@_;
my @out;
foreach my $f (@incs) {
open H, "<$f" || die;
my $first = "";
while(<H>) {
@ -59,7 +82,8 @@ sub scanheader {
if (/^(^CURL_EXTERN .*)\(/) {
my $decl = $1;
$decl =~ s/\r$//;
print "$decl\n";
$decl =~ /([a-z_]+)$/;
push(@out, "$1");
}
elsif (/^(^CURL_EXTERN .*)/) {
# handle two-line declarations
@ -72,7 +96,8 @@ sub scanheader {
my $decl = $1;
$decl =~ s/\r$//;
$first .= $decl;
print "$first\n";
$first =~ /([a-z_]+)$/;
push(@out, "$1");
}
$first = "";
}
@ -80,6 +105,10 @@ sub scanheader {
close H;
}
foreach my $i (@incs) {
scanheader($i);
if($sort) {
@out = sort(@out);
}
foreach (@out) {
print("$_\n");
}