curl-curl/tests/test1477.pl
Viktor Szakats 55509b045b
test1175: fix to run, and fix documentation issues detected
Fix test 1175 by passing the source root directory (was: tests).

Before this patch this caused silent Perl warnings and returning success
without executing the tests, due to:
```
readline() on closed filehandle $f at ../../tests/test1175.pl line 55.
readline() on closed filehandle $f at ../../tests/test1175.pl line 39.
```

Running the test revealed these issues:
```
CURLE_FUNCTION_NOT_FOUND is not in libcurl-errors.md
CURLE_HTTP_POST_ERROR is not in libcurl-errors.md
CURLE_TELNET_OPTION_SYNTAX is not in libcurl-errors.md
CURLM_CALL_MULTI_SOCKET is not in libcurl-errors.md
```

Apply fixes:
- mark `CURLE_FUNCTION_NOT_FOUND` deprecated by 7.53.0
- mark `CURLE_HTTP_POST_ERROR` deprecated by 7.56.0
- mark `CURLE_TELNET_OPTION_SYNTAX` deprecated by 7.78.0
- document `CURLM_CALL_MULTI_SOCKET` as a synonym for
  `CURLM_CALL_MULTI_PERFORM`
- test1477: exclude `CURLM_CALL_MULTI_SOCKET`.

But, these weren't officially deprecated. It may need more updates
to reflect that in other places, or fix the issues differently.

Follow-up to 66ec950004 #12424
Follow-up to 74f441c6d3 #4628

Cherry-picked from #17877
Closes #17880
2025-07-11 12:28:46 +02:00

103 lines
2.7 KiB
Perl
Executable File

#!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
# Check that libcurl-errors.3 and the public header files have the same set of
# error codes.
use strict;
use warnings;
# we may get the dir roots pointed out
my $root=$ARGV[0] || ".";
my $buildroot=$ARGV[1] || ".";
my $manpge = "$buildroot/docs/libcurl/libcurl-errors.3";
my $curlh = "$root/include/curl";
my $errors=0;
my @hnames;
my %wherefrom;
my @mnames;
my %manfrom;
sub scanheader {
my ($file)=@_;
open H, "<$file";
my $line = 0;
while(<H>) {
$line++;
if($_ =~ /^ (CURL(E|UE|SHE|HE|M)_[A-Z0-9_]*)/) {
my ($name)=($1);
if(($name !~ /(OBSOLETE|CURLE_RESERVED)/) && ($name !~ /_LAST\z/)) {
push @hnames, $name;
if($wherefrom{$name}) {
print STDERR "double: $name\n";
}
$wherefrom{$name}="$file:$line";
}
}
}
close(H);
}
sub scanmanpage {
my ($file)=@_;
open H, "<$file";
my $line = 0;
while(<H>) {
$line++;
if($_ =~ /^\.IP \"(CURL(E|UE|SHE|HE|M)_[A-Z0-9_]*)/) {
my ($name)=($1);
if($name !~ /(CURLM_CALL_MULTI_SOCKET)/) {
push @mnames, $name;
$manfrom{$name}="$file:$line";
}
}
}
close(H);
}
opendir(my $dh, $curlh) || die "Can't opendir $curlh: $!";
my @hfiles = grep { /\.h$/ } readdir($dh);
closedir $dh;
for(sort @hfiles) {
scanheader("$curlh/$_");
}
scanmanpage($manpge);
print "Result\n";
for my $h (sort @hnames) {
if(!$manfrom{$h}) {
printf "$h from %s, not in manpage\n", $wherefrom{$h};
}
}
for my $m (sort @mnames) {
if(!$wherefrom{$m}) {
printf "$m from %s, not in any header\n", $manfrom{$m};
}
}