From: Daniel Stenberg Date: Tue, 11 Jun 2024 07:30:29 +0000 (+0200) Subject: test1486: verify that write-out.md and tool_writeout.c are in sync X-Git-Tag: curl-8_9_0~265 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61b465208f936bdd9b713bd51b108a794bd843d6;p=thirdparty%2Fcurl.git test1486: verify that write-out.md and tool_writeout.c are in sync - also verify alphabetialal order in the source - add two missing variables to write-out.md Closes #13920 --- diff --git a/docs/cmdline-opts/write-out.md b/docs/cmdline-opts/write-out.md index 97cb1fe37b..634cc2c8fa 100644 --- a/docs/cmdline-opts/write-out.md +++ b/docs/cmdline-opts/write-out.md @@ -63,6 +63,11 @@ The variables available are: Output the certificate chain with details. Supported only by the OpenSSL, GnuTLS, Schannel and Secure Transport backends. (Added in 7.88.0) +## `conn_id` +The connection identifier last used by the transfer. The connection id is +unique number among all connections using the same connection cache. +(Added in 8.2.0) + ## `content_type` The Content-Type of the requested document, if there was any. @@ -309,3 +314,9 @@ same index number as the origin globbed URL. (Added in 7.75.0) ## `url_effective` The URL that was fetched last. This is most meaningful if you have told curl to follow location: headers. + +## `xfer_id` +The numerical identifier of the last transfer done. -1 if no transfer has been +started yet for the handle. The transfer id is unique among all transfers +performed using the same connection cache. +(Added in 8.2.0) diff --git a/tests/Makefile.am b/tests/Makefile.am index 726d37b52c..f9eccf1712 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,6 +40,7 @@ TESTSCRIPTS = \ test1275.pl \ test1276.pl \ test1477.pl \ + test1486.pl \ test1544.pl \ test971.pl diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index d1e7e4ce77..cadc37cccf 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -188,7 +188,7 @@ test1447 test1448 test1449 test1450 test1451 test1452 test1453 test1454 \ test1455 test1456 test1457 test1458 test1459 test1460 test1461 test1462 \ test1463 test1464 test1465 test1466 test1467 test1468 test1469 test1470 \ test1471 test1472 test1473 test1474 test1475 test1476 test1477 test1478 \ -test1479 test1480 test1481 test1482 test1483 test1484 test1485 \ +test1479 test1480 test1481 test1482 test1483 test1484 test1485 test1486 \ \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \ diff --git a/tests/data/test1486 b/tests/data/test1486 new file mode 100644 index 0000000000..e974b99e0c --- /dev/null +++ b/tests/data/test1486 @@ -0,0 +1,32 @@ + + + +source analysis +docs +--write-out + + + +# +# Client-side + + +none + + + +Verify that write-out.md and tool_writeout.c are in sync + + + +%SRCDIR/test1486.pl %SRCDIR + + + + + +OK + + + + diff --git a/tests/test1486.pl b/tests/test1486.pl new file mode 100755 index 0000000000..eb70d02d74 --- /dev/null +++ b/tests/test1486.pl @@ -0,0 +1,102 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, , 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 +# +########################################################################### +# +# + +use strict; +use warnings; + +# we may get the dir root pointed out +my $root=$ARGV[0] || "."; + +my %insrc; # variable set in source +my %indocs; # variable described in docs + +my $srccount = 1; +sub getsrcvars { + open(my $f, "<", "$root/../src/tool_writeout.c"); + my $mode = 0; + while(<$f>) { + if(!$mode && + ($_ =~ /^static const struct writeoutvar/)) { + $mode = 1; + } + if($mode) { + if($_ =~ /^}/) { + last; + } + if($_ =~ /^ \{\"([^\"]*)/) { + my $var = $1; + $insrc{$var} = $srccount++; + } + } + } + close($f); +} + +sub getdocsvars { + open(my $f, "<", "$root/../docs/cmdline-opts/write-out.md"); + while(<$f>) { + if($_ =~ /^\#\# \`([^\`]*)\`/) { + $indocs{$1} = 1; + } + } + close($f); +} + +getsrcvars(); +getdocsvars(); + +my $error = 0; + +if((scalar(keys %indocs) < 10) || (scalar(keys %insrc) < 10)) { + print "problems to extract variables\n"; + $error++; +} + +# also verify that the source code lists them alphabetically +my $check = 1; +for(sort keys %insrc) { + if($insrc{$_} && !$indocs{$_}) { + print "$_ is not mentioned in write.out.md\n"; + $error++; + } + if($insrc{$_} ne $check) { + print "$_ is not in alphabetical order\n"; + $error++; + } + $check++; +} + +for(sort keys %indocs) { + if($indocs{$_} && !$insrc{$_}) { + print "$_ documented, but not used in source code\n"; + $error++; + } +} + +print "OK\n" if(!$error); + +exit $error;