master
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###########################################################################
26use strict;
27use warnings;
29my @files = @ARGV;
30my $cfile = 'test-' . (defined $ENV{'CC'} ? $ENV{'CC'} : 'gcc') . '.c';
31my $check = "./scripts/checksrc.pl";
32my $error = 0;
34if(!@files || $files[0] eq "-h") {
35 print "Usage: verify-examples [markdown pages]\n";
36 exit;
37}
39sub testcompile {
40 my $cc = defined $ENV{'CC'} ? $ENV{'CC'} : 'gcc';
41 my $cflags = '';
42 if(defined $ENV{'CFLAGS'}) {
43 $cflags .= ' ' . $ENV{'CFLAGS'};
44 }
45 my $rc = system($cc . ' -c ' . $cfile . ' -I include -W -Wall -pedantic -Werror ' . $cflags . ' ' .
46 '-Wno-unused-parameter -Wno-unused-but-set-variable ' .
47 '-DCURL_ALLOW_OLD_MULTI_SOCKET -DCURL_DISABLE_DEPRECATION') >> 8;
48 return $rc;
49}
51sub checksrc {
52 my $rc = system($check, ($cfile)) >> 8;
53 return $rc;
54}
56sub extract {
57 my($f) = @_;
58 my $syn = 0;
59 my $l = 0;
60 my $iline = 0;
61 my $fail = 0;
62 open(F, "<", $f) or die "failed opening input file $f : $!";
63 open(O, ">", $cfile) or die "failed opening output file $cfile : $!";
64 print O "#include <curl/curl.h>\n";
65 while(<F>) {
66 $iline++;
67 if(/^# EXAMPLE/) {
68 $syn = 1
69 }
70 elsif($syn == 1) {
71 if(/^~~~/) {
72 $syn++;
73 print O "/* !checksrc! disable BANNEDFUNC all */\n"; # for fopen()
74 print O "/* !checksrc! disable COPYRIGHT all */\n";
75 print O "/* !checksrc! disable UNUSEDIGNORE all */\n";
76 printf O "#line %d \"$f\"\n", $iline + 1;
77 }
78 }
79 elsif($syn == 2) {
80 if(/^~~~/) {
81 last;
82 }
83 # two backslashes become one
84 $_ =~ s/\\\\/\\/g;
85 print O $_;
86 $l++;
87 }
88 }
89 close(F);
90 close(O);
92 return ($fail ? 0 : $l);
93}
95my $count = 0;
96for my $m (@files) {
97 #print "Verify $m\n";
98 my $out = extract($m);
99 if($out) {
100 $error |= testcompile($m);
101 $error |= checksrc($m);
102 }
103 $count++;
104}
105if(!$error) {
106 print "Verified $count man pages ok\n";
107}
108else {
109 print "Detected problems\n";
110}
111exit $error;
Diagnostics4 git calls · 36 ms
CallStatusSizeTime036 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.4 KiB · hit30 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=30 git.response.bytes=1456 git.response.cache=HIT git.response.duration_ms=30 git.fetch.wants=fe576afd4df7f4ce4c8c29aae60a6d7c9b656fcc git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1456 git.pkt.payload.max=1435 git.sideband.band1.bytes=1434 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e144d13f410bf5
- Request
- 04bbc6db…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format