master
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Fandrich, 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###########################################################################
26# This script is intended for developers to test some internals of the
27# runtests.pl harness. Do not try to use this unless you know what you are
28# doing!
30# An example command-line that starts a test http server for test 11 and waits
31# for the user before stopping it:
32# ./devtest.pl --verbose serverfortest https echo "Started https" protoport https preprocess 11 pause echo Stopping stopservers echo Done
33# curl can connect to the server while it is running like this:
34# curl -vkL https://localhost:<protoport>/11
36use strict;
37use warnings;
38use 5.006;
40BEGIN {
41 # Define srcdir to the location of the tests source directory. This is
42 # usually set by the Makefile, but for out-of-tree builds with direct
43 # invocation of runtests.pl, it may not be set.
44 if(!defined $ENV{'srcdir'}) {
45 use File::Basename;
46 $ENV{'srcdir'} = dirname(__FILE__);
47 }
48 push(@INC, $ENV{'srcdir'});
49}
51use globalconfig;
52use servers qw(
53 initserverconfig
54 protoport
55 serverfortest
56 stopservers
57 );
58use runner qw(
59 readtestkeywords
60 singletest_preprocess
61 );
62use testutil qw(
63 setlogfunc
64 );
65use getpart;
67#######################################################################
68# logmsg is our general message logging subroutine.
69# This function is currently required to be here by servers.pm
70# This is copied from runtests.pl
71#
72my $uname_release = qx(uname -r);
73my $is_wsl = $uname_release =~ /Microsoft$/;
74sub logmsg {
75 for(@_) {
76 my $line = $_;
77 if($is_wsl) {
78 # use \r\n for WSL shell
79 $line =~ s/\r?\n$/\r\n/g;
80 }
81 print $line;
82 }
83}
85#######################################################################
86# Parse and store the protocols in curl's Protocols: line
87# This is copied from runtests.pl
88#
89sub parseprotocols {
90 my ($line)=@_;
92 @protocols = split(' ', lc($line));
94 # Generate a "proto-ipv6" version of each protocol to match the
95 # IPv6 <server> name and a "proto-unix" to match the variant which
96 # uses Unix domain sockets. This works even if support is not
97 # compiled in because the <features> test fails.
98 push @protocols, map(("$_-ipv6", "$_-unix"), @protocols);
100 # 'http-proxy' is used in test cases to do CONNECT through
101 push @protocols, 'http-proxy';
103 # 'none' is used in test cases to mean no server
104 push @protocols, 'none';
105}
107#######################################################################
108# Initialize @protocols from the curl binary under test
109#
110sub init_protocols {
111 for(qx($CURL -V 2>$dev_null)) {
112 if(m/^Protocols: (.*)$/) {
113 parseprotocols($1);
114 }
115 }
116}
118#######################################################################
119# Initialize the test harness to run tests
120#
121sub init_tests {
122 setlogfunc(\&logmsg);
123 init_protocols();
124 initserverconfig();
125}
127#######################################################################
128# Main test loop
130init_tests();
132#***************************************************************************
133# Parse command-line options and commands
134#
135while(@ARGV) {
136 if($ARGV[0] eq "-h") {
137 print "Usage: devtest.pl [--verbose] [command [arg]...]\n";
138 print "command is one of:\n";
139 print " echo X\n";
140 print " pause\n";
141 print " preprocess\n";
142 print " protocols *|X[,Y...]\n";
143 print " protoport X\n";
144 print " serverfortest X[,Y...]\n";
145 print " stopservers\n";
146 print " sleep N\n";
147 exit 0;
148 }
149 elsif($ARGV[0] eq "--verbose") {
150 $verbose = 1;
151 }
152 elsif($ARGV[0] eq "sleep") {
153 shift @ARGV;
154 sleep $ARGV[0];
155 }
156 elsif($ARGV[0] eq "echo") {
157 shift @ARGV;
158 print $ARGV[0] . "\n";
159 }
160 elsif($ARGV[0] eq "pause") {
161 print "Press Enter to continue: ";
162 readline STDIN;
163 }
164 elsif($ARGV[0] eq "protocols") {
165 shift @ARGV;
166 if($ARGV[0] eq "*") {
167 init_protocols();
168 }
169 else {
170 @protocols = split(",", $ARGV[0]);
171 }
172 print "Set " . scalar @protocols . " protocols\n";
173 }
174 elsif($ARGV[0] eq "preprocess") {
175 shift @ARGV;
176 loadtest("${TESTDIR}/test${ARGV[0]}", 1);
177 readtestkeywords();
178 singletest_preprocess($ARGV[0]);
179 }
180 elsif($ARGV[0] eq "protoport") {
181 shift @ARGV;
182 my $port = protoport($ARGV[0]);
183 print "protoport: $port\n";
184 }
185 elsif($ARGV[0] eq "serverfortest") {
186 shift @ARGV;
187 my ($why, $e) = serverfortest(split(/,/, $ARGV[0]));
188 print "serverfortest: $e $why\n";
189 }
190 elsif($ARGV[0] eq "stopservers") {
191 my $err = stopservers();
192 print "stopservers: $err\n";
193 }
194 else {
195 print "Error: Unknown command: $ARGV[0]\n";
196 print "Continuing anyway\n";
197 }
198 shift @ARGV;
199}
Diagnostics4 git calls · 54 ms
CallStatusSizeTime054 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs 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 · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 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 · hit21 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=21 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
fetch2002.2 KiB · hit31 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=31 git.response.bytes=2255 git.response.cache=HIT git.response.duration_ms=31 git.fetch.wants=322b6904b6da8603cec7c683a1016204c019ba57 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=2255 git.pkt.payload.max=2234 git.sideband.band1.bytes=2233 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
- a5e22d5abb40a594
- Request
- 34ff48a8…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format