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###########################################################################
25use strict;
26use warnings;
28# Prepare a directory with known files and clean up afterwards
29use Time::Local;
31if($#ARGV < 1) {
32 print "Usage: $0 prepare|postprocess directory [logfile]\n";
33 exit 1;
34}
36# <precheck> expects an error message on stdout
37sub errout {
38 print $_[0] . "\n";
39 exit 1;
40}
42if($ARGV[0] eq "prepare") {
43 my $dirname = $ARGV[1];
44 mkdir $dirname or errout "$!";
45 chdir $dirname;
47 # Create the files in alphabetical order, to increase the chances
48 # of receiving a consistent set of directory contents regardless
49 # of whether the server alphabetizes the results or not.
50 mkdir "asubdir" or errout "$!";
51 chmod 0777, "asubdir";
53 open(FILE, ">", 'plainfile.txt') or errout "$!";
54 binmode FILE;
55 print FILE "Test file to support curl test suite\n";
56 close(FILE);
57 # The mtime is specifically chosen to be an even number so that it can be
58 # represented exactly on a FAT file system.
59 utime time, timegm(0, 0, 12, 1, 0, 100), "plainfile.txt";
60 chmod 0666, "plainfile.txt";
62 open(FILE, ">", 'emptyfile.txt') or errout "$!";
63 binmode FILE;
64 close(FILE);
65 # The mtime is specifically chosen to be an even number so that it can be
66 # represented exactly on a FAT file system.
67 utime time, timegm(0, 0, 12, 1, 0, 100), "emptyfile.txt";
68 chmod 0666, "emptyfile.txt";
70 open(FILE, ">", 'rofile.txt') or errout "$!";
71 binmode FILE;
72 print FILE "Read-only test file to support curl test suite\n";
73 close(FILE);
74 # The mtime is specifically chosen to be an even number so that it can be
75 # represented exactly on a FAT file system.
76 utime time, timegm(0, 0, 12, 31, 11, 100), "rofile.txt";
77 chmod 0444, "rofile.txt";
78 if($^O eq 'cygwin') {
79 system('chattr', ('+r', 'rofile.txt'));
80 }
82 exit 0;
83}
84elsif($ARGV[0] eq "postprocess") {
85 my $dirname = $ARGV[1];
87 # Clean up the test directory
88 if($^O eq 'cygwin') {
89 system('chattr', ('-r', "$dirname/rofile.txt"));
90 }
91 chmod 0666, "$dirname/rofile.txt";
92 unlink "$dirname/rofile.txt";
93 unlink "$dirname/emptyfile.txt";
94 unlink "$dirname/plainfile.txt";
95 rmdir "$dirname/asubdir";
97 rmdir $dirname or die "$!";
99 if($#ARGV >= 3) { # Verify mtime if requested
100 my $checkfile = $ARGV[2];
101 my $expected_mtime = int($ARGV[3]);
102 my $mtime = (stat($checkfile))[9];
103 exit ($mtime != $expected_mtime);
104 }
106 my $logfile = $ARGV[2];
107 if($logfile && -s $logfile) {
108 # Process the directory file to remove all information that
109 # could be inconsistent from one test run to the next (e.g.
110 # file date) or may be unsupported on some platforms (e.g.
111 # Windows). Also, since 7.17.0, the sftp directory listing
112 # format can be dependent on the server (with a recent
113 # enough version of libssh2) so this script must also
114 # canonicalize the format. Here are examples of the general
115 # format supported:
116 # -r--r--r-- 12 ausername grp 47 Dec 31 2000 rofile.txt
117 # -r--r--r-- 1 1234 4321 47 Dec 31 2000 rofile.txt
118 # The "canonical" format is similar to the first (which is
119 # the one generated on a typical Linux installation):
120 # -r-?r-?r-? 12 U U 47 Dec 31 2000 rofile.txt
122 my @canondir;
123 open(IN, "<", $logfile) or die "$!";
124 while(<IN>) {
125 /^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)\s+(.*)$/;
126 if($1 eq "d") {
127 # Skip current and parent directory listing, because some SSH
128 # servers (eg. OpenSSH for Windows) are not listing those
129 if($8 eq "." || $8 eq "..") {
130 next;
131 }
132 # Erase all directory metadata except for the name, as it is not
133 # consistent for across all test systems and file systems
134 push @canondir, "d????????? N U U N ??? N NN:NN $8\n";
135 }
136 elsif($1 eq "-") {
137 # Ignore group and other permissions, because these may vary on
138 # some systems (e.g. on Windows)
139 # Erase user and group names, as they are not consistent across
140 # all test systems
141 my $line = sprintf("%s%s???????%5d U U %15d %s %s\n", $1, $2, $5, $6, $7, $8);
142 push @canondir, $line;
143 }
144 else {
145 # Unexpected format; pass it through and let the test fail
146 push @canondir, $_;
147 }
148 }
149 close(IN);
151 @canondir = sort {substr($a, 57) cmp substr($b, 57)} @canondir;
152 my $newfile = $logfile . ".new";
153 open(OUT, ">", $newfile) or die "$!";
154 print OUT join('', @canondir);
155 close(OUT);
157 unlink $logfile;
158 rename $newfile, $logfile;
159 }
161 exit 0;
162}
163print "Unsupported command $ARGV[0]\n";
164exit 1;
Diagnostics4 git calls · 37 ms
CallStatusSizeTime037 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=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 · hit6 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=28 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=6 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.3 KiB · hit28 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=2362 git.response.cache=HIT git.response.duration_ms=28 git.fetch.wants=a2886c4786b11ff3ba44e03c9cbde6b8fe3340fe 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=2362 git.pkt.payload.max=2341 git.sideband.band1.bytes=2340 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
- a5e27c390aefc892
- Request
- cf407e5c…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format