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#
25###########################################################################
26#
27# Check the OS/400 translating wrapper properly handles all translatable
28# string options.
30use strict;
31use warnings;
33my $root = $ARGV[0] || ".";
34my $incdir = "$root/include/curl";
35my $os400dir = "$root/projects/OS400";
36my $errcount = 0;
38# Scan header file for string option definitions.
39sub scan_header {
40 my ($f) = @_;
41 my $line = "";
42 my $incomment = 0;
43 my @stringopts;
45 open(my $h, "<", $f);
46 while(<$h>) {
47 s/^\s*(.*?)\s*$/$1/; # Trim.
48 # Remove multi-line comment trail.
49 if($incomment) {
50 if($_ !~ /.*?\*\/\s*(.*)$/) {
51 next;
52 }
53 $_ = $1;
54 $incomment = 0;
55 }
56 if($line ne "") {
57 # Unfold line.
58 $_ = "$line $1";
59 $line = "";
60 }
61 if($_ =~ /^(.*)\\$/) {
62 $line = "$1 ";
63 next;
64 }
65 # Remove comments.
66 while($_ =~ /^(.*?)\/\*.*?\*\/(.*)$/) {
67 $_ = "$1 $2";
68 }
69 if($_ =~ /^(.*)\/\*/) {
70 $_ = "$1 ";
71 $incomment = 1;
72 }
73 s/^\s*(.*?)\s*$/$1/; # Trim again.
74 # Ignore preprocessor directives and blank lines.
75 if($_ =~ /^(?:#|$)/) {
76 next;
77 }
78 # Handle lines that may be continued as if they were folded.
79 if($_ !~ /[;,{}]$/ || $_ =~ /[^)],$/) {
80 # Folded line.
81 $line = $_;
82 next;
83 }
84 # Keep string options only.
85 if($_ =~ /CURLOPT(?:DEPRECATED)?\s*\(\s*([^, \t]+)\s*,\s*CURLOPTTYPE_STRINGPOINT/) {
86 push(@stringopts, $1);
87 }
88 }
89 close $h;
90 return @stringopts;
91}
93# Scan projects/OS400/ccsidcurl.c for translatable string option cases.
94sub scan_wrapper_for_strings {
95 my ($f) = @_;
96 my $inarmor = 0;
97 my @stringopts;
99 open(my $h, "<", $f);
100 while(<$h>) {
101 if($_ =~ /(BEGIN|END) TRANSLATABLE STRING OPTIONS/) {
102 $inarmor = $1 eq "BEGIN";
103 }
104 elsif($inarmor && $_ =~ /case\s+([^:]+):/) {
105 push(@stringopts, $1);
106 }
107 }
108 close $h;
109 return @stringopts;
110}
112# Get translatable string options from header file.
113my @stringdefs = scan_header("$incdir/curl.h");
115# Get translated string options.
116my @stringrefs = scan_wrapper_for_strings("$os400dir/ccsidcurl.c");
118# Lists should be equal: check differences.
119my %diff;
120@diff{@stringdefs} = 0..$#stringdefs;
121delete @diff{@stringrefs};
123foreach(keys %diff) {
124 print "$_ is not translated\n";
125 delete $diff{$_};
126 $errcount++;
127}
129@diff{@stringrefs} = 0..$#stringrefs;
130delete @diff{@stringdefs};
132foreach(keys %diff) {
133 print "translated option $_ does not exist\n";
134 $errcount++;
135}
137# Check translated string option cases are sorted alphanumerically.
138foreach(my $i = 1; $i < $#stringrefs; $i++) {
139 if($stringrefs[$i] lt $stringrefs[$i - 1]) {
140 print("Translated string options are not sorted (" . $stringrefs[$i - 1] .
141 "/" . $stringrefs[$i] . ")\n");
142 $errcount++;
143 last;
144 }
145}
147exit !!$errcount;
Diagnostics4 git calls · 41 ms
CallStatusSizeTime041 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 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 · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=36 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=2 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.7 KiB · hit36 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1716 git.response.cache=HIT git.response.duration_ms=36 git.fetch.wants=2703ac1e74a03d3f605bbbb59ccbf127737d8911 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=1716 git.pkt.payload.max=1695 git.sideband.band1.bytes=1694 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
- a5e2d4395e75689d
- Request
- 4ce22194…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format