xref: /curl/tests/test1175.pl (revision fc84583a)
1#!/usr/bin/env perl
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
25#
26#
27
28use strict;
29use warnings;
30
31# we may get the dir root pointed out
32my $root=$ARGV[0] || ".";
33
34my %error; # from the include file
35my %docs; # from libcurl-errors.3
36
37sub getdocserrors {
38    open(my $f, "<", "$root/docs/libcurl/libcurl-errors.md");
39    while(<$f>) {
40        if($_ =~ /^## (CURL[EM]_[^ ]*)/) {
41            my ($symbol) = ($1);
42            if($symbol =~ /OBSOLETE/) {
43                ;
44            }
45            else {
46                $docs{$symbol}=1;
47            }
48        }
49    }
50    close($f);
51}
52
53sub getincludeerrors {
54    open(my $f, "<", "$root/docs/libcurl/symbols-in-versions");
55    while(<$f>) {
56        if($_ =~ /^(CURL[EM]_[^ \t]*)[ \t]*([0-9.]+)[ \t]*(.*)/) {
57            my ($symbol, $added, $rest) = ($1,$2,$3);
58            if($rest =~ /^([0-9.]+)/) {
59                # removed!
60            }
61            else {
62                $error{$symbol}=$added;
63            }
64        }
65    }
66    close($f);
67}
68
69getincludeerrors();
70getdocserrors();
71
72for(sort keys %error) {
73    if($error{$_} && !$docs{$_}) {
74        print "$_ is not in libcurl-errors.md\n";
75    }
76}
77
78for(sort keys %docs) {
79    if($docs{$_} && !$error{$_}) {
80        print "$_ is not in symbols-in-versions\n";
81    }
82}
83