mirror of
https://github.com/curl/curl.git
synced 2026-04-14 13:01:42 +08:00
Extend existing `--enable-test-bundles` and `-DCURL_TEST_BUNDLES=ON` options to also bundle test server programs into a single binary. With autotools, also bundle auxiliary libcurl sources for a "unity"-style build. It saves almost 10 minutes per run, across all CI jobs. On average it makes `build tests` steps 25% faster. With CMake, it brings down `testdeps` build steps to 32 to 37, from 45 to 64 before this patch, with unity. Without unity it brings it down from 400-420 to 280-300. For comparison, without unity and bundles, the number of build steps is around 1850. With autotools the gain is possibly larger because this patch does unity and bundle for test servers. The total reduction of build steps / log lines is 12000. It's 44% of reduction on average across all CI jobs. Follow-up to77401af485#16695 Follow-up to71cf0d1fca#14772 Comparison of 'build tests' targets in S(econds) and L(ines/steps), between before and after this patch: CI job |BefS|AftS|Gain|BefL|AftL|Gain| Comments :---------------------------------------- | -: | -: | -: | --:| --:| --:| :------- GHA/windows | | | | | | | Cygwin AM |110 | 95 | 15 | 237| 88| 149| l(ines) Cygwin CM | 34 | 27 | 7 | 63| 36| 27| s(teps, with Ninja) msys2, AM x86_64 !proxy | 35 | 21 | 14 | 255| 108| 147| l msys2, AM x86_64 default | 35 | 22 | 13 | 255| 108| 147| l msys2, CM x86_64 default | 14 | 11 | 3 | 63| 36| 27| s msys2, AM x86_64 default R | 41 | 29 | 12 | 245| 96| 149| l mingw, AM x86_64 default | 69 | 33 | 36 | 331| 156| 175| l mingw, AM x86_64 c-ares U | 69 | 33 | 36 | 331| 156| 175| l mingw, CM x86_64 schannel c-ares U | 32 | 24 | 8 | 63| 36| 27| s mingw, CM clang-x86_64 gnutls | 9 | 6 | 3 | 63| 36| 27| s mingw, CM ucrt-x86_64 schannel R TrackMem | 43 | 35 | 8 | 64| 37| 27| s mingw, CM clang-x86_64 openssl | 20 | 18 | 2 | 63| 36| 27| s mingw, CM ucrt-x86_64 schannel uwp | 36 | 34 | 2 | 47| 34| 13| s mingw, CM x86_64 schannel dev debug | 32 | 24 | 8 | 64| 37| 27| s mingw, CM i686 schannel R | 38 | 37 | 1 | 47| 34| 13| s dl-mingw, CM 9.5.0-x86_64 schan |102 | 94 | 8 | 63| 36| 27| s dl-mingw, CM 7.3.0-x86_64 schan mbedtls U | 32 | 24 | 8 | 94| 60| 34| l dl-mingw, CM 6.4.0-i686 schannel !unity | 42 | 31 | 11 | 427| 297| 130| l (no unity, yes bundle) linux-mingw, AM gcc | - | - | | -| -| | linux-mingw, CM gcc | 12 | 10 | 2 | 46| 33| 13| s mingw32ce, AM 4.4.0-arm schannel | - | - | | -| -| | mingw32ce, CM 4.4.0-arm schannel | 30 | 31 | -1 | 81| 61| 20| l msvc, CM x64-uwp openssl +examples | 13 | 10 | 3 | 102| 68| 34| l msvc, CM x64-windows openssl | 13 | 10 | 3 | 102| 68| 34| l msvc, CM x64-windows schannel MultiSSL U | 13 | 10 | 3 | 102| 68| 34| l msvc, CM x64-windows libressl | 14 | 13 | 1 | 102| 68| 34| l msvc, CM x64-windows boringssl | 11 | 11 | 0 | 84| 64| 20| l msvc, CM x64-windows wolfssl +examples | 13 | 10 | 3 | 102| 68| 34| l msvc, CM x64-windows mbedtls libssh | 14 | 10 | 4 | 102| 68| 34| l GHA/old-linux: | | | | | | | linux (cmake & autoconf) AM | 14 | 11 | 3 | 217| 75| 142| l linux (cmake & autoconf) CM | 15 | 13 | 2 | 545| 380| 165| l GHA/non-native: | | | | | | | AmigaOS, AM gcc AmiSSL m68k | - | - | | -| -| | AmigaOS, CM gcc AmiSSL m68k | 8 | 7 | 1 | 78| 58| 20| l Android 21, AM openssl arm64 | 7 | 5 | 2 | 222| 80| 142| l Android 21, CM openssl arm64 | 4 | 5 | -1 | 81| 61| 20| l Android 35, AM openssl arm64 | 7 | 5 | 2 | 222| 80| 142| l Android 35, CM boringssl !zstd arm64 | 4 | 3 | 1 | 81| 61| 20| l Android 35, CM openssl arm64 | 5 | 4 | 1 | 81| 61| 20| l FreeBSD, AM clang openssl arm64 | - | - | | -| -| | FreeBSD, AM clang openssl x86_64 | 7 | 3 | 4 | 513| 133| 380| l FreeBSD, CM clang openssl !unity !bundle..| 49 | 47 | 2 |1841|1841| | s (no unity, no bundle) FreeBSD, CM clang openssl arm64 | - | - | | -| -| | MS-DOS, AM djgpp openssl i586 | - | - | | -| -| | MS-DOS, CM djgpp openssl i586 | 6 | 7 | -1 | 45| 32| 13| s NetBSD, CM clang openssl x86_64 | 15 | 13 | 2 | 62| 35| 27| s OmniOS, AM gcc openssl amd64 | 20 | 11 | 9 | 216| 74| 142| l OpenBSD, CM clang libressl x86_64 | 9 | 7 | 2 | 62| 35| 27| s iOS, AM libressl arm64 | 6 | 3 | 3 | 217| 68| 149| l iOS, CM libressl arm64 | 10 | 10 | 0 | 236| 175| 61| l iOS, CM-Xcode libressl arm64 | 13 | 8 | 5 | 899| 627| 272| l GHA/linux: | | | | | | | AM bearssl | 9 | 8 | 1 | 258| 111| 147| l AM bearssl clang | 6 | 4 | 2 | 258| 111| 147| l AM libressl heimdal | 11 | 8 | 3 | 267| 120| 147| l CM libressl heimdal valgrind | 8 | 5 | 3 | 62| 35| 27| s AM libressl clang | 7 | 4 | 3 | 258| 111| 147| l AM wolfssl-all | 11 | 8 | 3 | 258| 111| 147| l AM wolfssl-opensslextra valgrind | 11 | 7 | 4 | 258| 111| 147| l AM mbedtls valgrind | 10 | 7 | 3 | 258| 111| 147| l AM mbedtls clang | 6 | 3 | 3 | 258| 111| 147| l CM mbedtls | 7 | 6 | 1 | 62| 35| 27| s CM mbedtls-pkg | 7 | 7 | 0 | 62| 35| 27| s CM mbedtls-pkg !pc | - | - | | -| -| | AM msh3 | 10 | 7 | 3 | 258| 111| 147| l CM msh3 | 7 | 7 | 0 | 62| 35| 27| s AM awslc | 18 | 15 | 3 | 247| 98| 149| l CM awslc | 13 | 11 | 2 | 400| 277| 123| s (no unity, yes bundle) AM openssl default | 10 | 7 | 3 | 258| 111| 147| l AM openssl libssh2 sync-resolver valgrind | 10 | 7 | 3 | 258| 111| 147| l AM openssl | 11 | 7 | 4 | 258| 111| 147| l AM openssl -O3 valgrind | 26 | 21 | 5 | 258| 111| 147| l AM openssl clang krb5 | 7 | 3 | 4 | 265| 118| 147| l CM openssl clang krb5 LTO | - | - | | -| -| | AM openssl !ipv6 !--libcurl | 10 | 7 | 3 | 258| 111| 147| l AM openssl https-only | 11 | 8 | 3 | 258| 111| 147| l CM openssl torture !FTP | 7 | 6 | 1 | 62| 35| 27| s CM openssl torture FTP | 8 | 6 | 2 | 62| 35| 27| s AM openssl i686 | 12 | 9 | 3 | 258| 111| 147| l AM !ssl !http !smtp !imap | 10 | 7 | 3 | 258| 111| 147| l AM clang-tidy | - | - | | -| -| | AM scanbuild | - | - | | -| -| | AM address-sanitizer | 10 | 6 | 4 | 258| 111| 147| l AM thread-sanitizer | 7 | 4 | 3 | 258| 111| 147| l AM memory-sanitizer | 10 | 6 | 4 | 258| 111| 147| l AM event-based | 10 | 7 | 3 | 253| 106| 147| l AM duphandle | 10 | 8 | 2 | 253| 106| 147| l AM rustls valgrind | 10 | 8 | 2 | 258| 111| 147| l CM rustls | 7 | 5 | 2 | 62| 35| 27| s AM IntelC openssl | 18 | 14 | 4 | 572| 282| 290| l AM Slackware openssl gssapi gcc | 17 | 14 | 3 | 252| 103| 149| l AM Alpine MUSL https-rr | 15 | 11 | 4 | 266| 119| 147| l AM Alpine MUSL c-ares https-rr | 15 | 11 | 4 | 266| 119| 147| l GHA/linux-http3: | | | | | | | AM quictls | 12 | 8 | 4 | 258| 111| 147| l AM gnutls | 11 | 8 | 3 | 257| 110| 147| l AM wolfssl | 11 | 9 | 2 | 257| 110| 147| l CM wolfssl | 8 | 7 | 1 | 62| 35| 27| s AM openssl-quic | 11 | 8 | 3 | 257| 110| 147| l AM quiche | 11 | 9 | 2 | 257| 110| 147| l CM quiche | 8 | 6 | 2 | 62| 35| 27| s GHA/macos: | | | | | | | AM clang !ssl !debug brotli zstd | 5 | 3 | 2 | 218| 69| 149| l AM clang !ssl | 4 | 5 | -1 | 227| 80| 147| l AM clang !ssl libssh2 AppleIDN | 5 | 1 | 4 | 227| 80| 147| l AM clang OpenSSL libssh c-ares | 4 | 2 | 2 | 227| 80| 147| l AM clang !ssl c-ares | 4 | 5 | -1 | 227| 80| 147| l AM clang !ssl HTTP-only | 4 | 2 | 2 | 222| 75| 147| l AM clang SecureTransport libssh2 | 3 | 3 | 0 | 227| 80| 147| l AM clang SecureTransport libssh2 10.12 | 4 | 2 | 2 | 227| 80| 147| l AM clang LibreSSL +examples | 5 | 2 | 3 | 227| 80| 147| l AM clang OpenSSL | 6 | 1 | 5 | 227| 80| 147| l AM clang OpenSSL event-based | 5 | 3 | 2 | 227| 80| 147| l AM clang quictls libssh2 !ldap 10.15 | 4 | 2 | 2 | 227| 80| 147| l CM clang OpenSSL gsasl rtmp AppleIDN | 2 | 2 | 0 | 45| 32| 13| s CM clang OpenSSL AppleIDN clang-tidy +e |150 | 76 | 74 | 400| 277| 123| s (clang-tidy) CM clang quictls +static libssh +examples | 2 | 2 | 0 | 45| 32| 13| s CM clang SecureTransport debug | 2 | 2 | 0 | 62| 35| 27| s CM clang LibreSSL !ldap heimdal c-ares +e | 4 | 2 | 2 | 45| 32| 13| s CM clang wolfSSL !ldap brotli zstd | 1 | 2 | -1 | 45| 32| 13| s CM clang mbedTLS openldap brotli zstd | 1 | 2 | -1 | 45| 32| 13| s CM clang GnuTLS !ldap krb5 | 0 | 1 | 0 | 45| 32| 13| s CM clang OpenSSL torture !FTP | 2 | 1 | 1 | 61| 34| 27| s CM clang OpenSSL torture FTP | 2 | 1 | 1 | 61| 34| 27| s AM llvm@15 OpenSSL libssh | 5 | 4 | 1 | 227| 80| 147| l CM llvm@15 OpenSSL gsasl rtmp AppleIDN | 3 | 2 | 1 | 45| 32| 13| s CM llvm@15 quictls +static libssh +e | 2 | 2 | 0 | 45| 32| 13| s CM llvm@15 SecureTransport debug | 3 | 2 | 1 | 62| 35| 27| s CM llvm@15 LibreSSL !ldap heimdal c-ares..| 3 | 1 | 2 | 45| 32| 13| s CM llvm@15 wolfSSL !ldap brotli zstd | 3 | 2 | 1 | 45| 32| 13| s CM llvm@15 mbedTLS openldap brotli zstd | 2 | 2 | 0 | 45| 32| 13| s CM llvm@15 GnuTLS !ldap krb5 | 2 | 1 | 1 | 45| 32| 13| s AM gcc-12 !ssl !debug | 18 | 12 | 6 | 218| 69| 149| l AM gcc-12 SecureTransport libssh2 | 13 | 6 | 7 | 227| 80| 147| l CM gcc-12 OpenSSL gsasl rtmp AppleIDN | 7 | 5 | 2 | 45| 32| 13| s CM gcc-12 quictls +static libssh +e | 8 | 6 | 2 | 45| 32| 13| s CM gcc-12 SecureTransport debug | 8 | 6 | 2 | 62| 35| 27| s CM gcc-12 LibreSSL !ldap heimdal c-ares...| 7 | 6 | 1 | 45| 32| 13| s CM gcc-12 wolfSSL !ldap brotli zstd | 16 | 6 | 10 | 45| 32| 13| s CM gcc-12 mbedTLS openldap brotli zstd | 11 | 6 | 5 | 45| 32| 13| s CM gcc-12 GnuTLS !ldap krb5 | 7 | 5 | 2 | 45| 32| 13| s AppVeyor: | | | | | | | VS2008 D x86 OpenSSL + Schannel SH +e | 56 | 39 | 17 | 21| 14| 7| s (VCBuild) VS2010 D x64 Schannel SH +e | 14 | 12 | 2 | 105| 78| 27| l VS2012 R x86 OpenSSL + Schannel SH | 23 | 21 | 2 | 84| 64| 20| l VS2013 D x64 OpenSSL SH Build-only | - | - | | -| -| | (no build tests) VS2015 D x64 OpenSSL ST Build-only | - | - | | -| -| | (no build tests) VS2017 D x64 OpenSSL SH Build-only | - | - | | -| -| | (no build tests) VS2019 D x64 OpenSSL + Schannel SH | 33 | 26 | 7 | 81| 61| 20| l VS2022 D x64 !SSL ST | 32 | 25 | 7 | 79| 59| 20| l VS2022 D x64 !SSL ST HTTP-only | 33 | 22 | 11 | 79| 59| 20| l VS2022 R arm64 Schannel ST | 74 | 69 | 5 | 79| 59| 20| l VS2022 R x64 Schannel SH U DBGBLD !CURLDBG| 66 | 61 | 5 | 78| 58| 20| l VS2022 D x64 Schannel ST U | 34 | 25 | 9 | 79| 59| 20| l VS2022 D x64 Schannel ST U clang-cl +e | 42 | 34 | 8 | 53| 40| 13| l VS2022 R x64 OpenSSL SH | 60 | 58 | 2 | 83| 63| 20| l Total |2394|1807|-587| 26k| 14k|-12k| in % | | |-24%| | |-45%| in minutes | | |9m47| | | | Before: GHA/windows: https://github.com/curl/curl/actions/runs/13854983424 GHA/old-linux: https://github.com/curl/curl/actions/runs/13854983399 GHA/non-native: https://github.com/curl/curl/actions/runs/13854983427 GHA/linux-http3: https://github.com/curl/curl/actions/runs/13854983409 GHA/linux: https://github.com/curl/curl/actions/runs/13854983406 GHA/macos: https://github.com/curl/curl/actions/runs/13854983401 Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51703551 After: GHA/windows: https://github.com/curl/curl/actions/runs/13860433850?pr=15000 GHA/old-linux: https://github.com/curl/curl/actions/runs/13860433809?pr=15000 GHA/non-native: https://github.com/curl/curl/actions/runs/13860433828?pr=15000 GHA/linux-http3: https://github.com/curl/curl/actions/runs/13860433806?pr=15000 GHA/linux: https://github.com/curl/curl/actions/runs/13860433848?pr=15000 GHA/macos: https://github.com/curl/curl/actions/runs/13860433835?pr=15000 Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51704222 Closes #15000
328 lines
10 KiB
Perl
328 lines
10 KiB
Perl
#***************************************************************************
|
|
# _ _ ____ _
|
|
# Project ___| | | | _ \| |
|
|
# / __| | | | |_) | |
|
|
# | (__| |_| | _ <| |___
|
|
# \___|\___/|_| \_\_____|
|
|
#
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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
|
|
#
|
|
#***************************************************************************
|
|
|
|
# This perl module contains functions useful in writing test servers.
|
|
|
|
package serverhelp;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
BEGIN {
|
|
use base qw(Exporter);
|
|
|
|
our @EXPORT_OK = qw(
|
|
logmsg
|
|
$logfile
|
|
serverfactors
|
|
servername_id
|
|
servername_str
|
|
servername_canon
|
|
server_pidfilename
|
|
server_portfilename
|
|
server_logfilename
|
|
server_cmdfilename
|
|
server_inputfilename
|
|
server_outputfilename
|
|
server_exe
|
|
server_exe_args
|
|
mainsockf_pidfilename
|
|
mainsockf_logfilename
|
|
datasockf_pidfilename
|
|
datasockf_logfilename
|
|
);
|
|
|
|
# sub second timestamping needs Time::HiRes
|
|
eval {
|
|
no warnings "all";
|
|
require Time::HiRes;
|
|
import Time::HiRes qw( gettimeofday );
|
|
}
|
|
}
|
|
|
|
use globalconfig;
|
|
use pathhelp qw(
|
|
exe_ext
|
|
);
|
|
|
|
our $logfile; # server log file name, for logmsg
|
|
|
|
#***************************************************************************
|
|
# Just for convenience, test harness uses 'https' and 'httptls' literals as
|
|
# values for 'proto' variable in order to differentiate different servers.
|
|
# 'https' literal is used for stunnel based https test servers, and 'httptls'
|
|
# is used for non-stunnel https test servers.
|
|
|
|
#**********************************************************************
|
|
# logmsg is general message logging subroutine for our test servers.
|
|
#
|
|
sub logmsg {
|
|
my $now;
|
|
# sub second timestamping needs Time::HiRes
|
|
if($Time::HiRes::VERSION) {
|
|
my ($seconds, $usec) = gettimeofday();
|
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
|
localtime($seconds);
|
|
$now = sprintf("%02d:%02d:%02d.%06d ", $hour, $min, $sec, $usec);
|
|
}
|
|
else {
|
|
my $seconds = time();
|
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
|
localtime($seconds);
|
|
$now = sprintf("%02d:%02d:%02d ", $hour, $min, $sec);
|
|
}
|
|
# we see warnings on Windows run that $logfile is used uninitialized
|
|
# TODO: not found yet where this comes from
|
|
$logfile = "serverhelp_uninitialized.log" if(!$logfile);
|
|
if(open(my $logfilefh, ">>", "$logfile")) {
|
|
print $logfilefh $now;
|
|
print $logfilefh @_;
|
|
close($logfilefh);
|
|
}
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return server characterization factors given a server id string.
|
|
#
|
|
sub serverfactors {
|
|
my $server = $_[0];
|
|
my $proto;
|
|
my $ipvnum;
|
|
my $idnum;
|
|
|
|
if($server =~
|
|
/^((ftp|http|imap|pop3|smtp|http-pipe)s?)(\d*)(-ipv6|)$/) {
|
|
$proto = $1;
|
|
$idnum = ($3 && ($3 > 1)) ? $3 : 1;
|
|
$ipvnum = ($4 && ($4 =~ /6$/)) ? 6 : 4;
|
|
}
|
|
elsif($server =~
|
|
/^(tftp|sftp|socks|ssh|rtsp|gopher|httptls)(\d*)(-ipv6|)$/) {
|
|
$proto = $1;
|
|
$idnum = ($2 && ($2 > 1)) ? $2 : 1;
|
|
$ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4;
|
|
}
|
|
else {
|
|
die "invalid server id: '$server'"
|
|
}
|
|
return($proto, $ipvnum, $idnum);
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return server name string formatted for presentation purposes
|
|
#
|
|
sub servername_str {
|
|
my ($proto, $ipver, $idnum) = @_;
|
|
|
|
$proto = uc($proto) if($proto);
|
|
die "unsupported protocol: '$proto'" unless($proto &&
|
|
($proto =~ /^(((FTP|HTTP|HTTP\/2|HTTP\/3|IMAP|POP3|GOPHER|SMTP|HTTP-PIPE)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|HTTPTLS|DICT|SMB|SMBS|TELNET|MQTT))$/));
|
|
|
|
$ipver = (not $ipver) ? 'ipv4' : lc($ipver);
|
|
die "unsupported IP version: '$ipver'" unless($ipver &&
|
|
($ipver =~ /^(4|6|ipv4|ipv6|-ipv4|-ipv6|unix)$/));
|
|
$ipver = ($ipver =~ /6$/) ? '-IPv6' : (($ipver =~ /unix$/) ? '-unix' : '');
|
|
|
|
$idnum = 1 if(not $idnum);
|
|
die "unsupported ID number: '$idnum'" unless($idnum &&
|
|
($idnum =~ /^(\d+)$/));
|
|
$idnum = '' if($idnum <= 1);
|
|
|
|
return "${proto}${idnum}${ipver}";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return server name string formatted for identification purposes
|
|
#
|
|
sub servername_id {
|
|
my ($proto, $ipver, $idnum) = @_;
|
|
return lc(servername_str($proto, $ipver, $idnum));
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return server name string formatted for file name purposes
|
|
#
|
|
sub servername_canon {
|
|
my ($proto, $ipver, $idnum) = @_;
|
|
my $string = lc(servername_str($proto, $ipver, $idnum));
|
|
$string =~ tr/-/_/;
|
|
$string =~ s/\//_v/;
|
|
return $string;
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for server pid file.
|
|
#
|
|
sub server_pidfilename {
|
|
my ($piddir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.pid';
|
|
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
#***************************************************************************
|
|
# Return file name for server port file.
|
|
#
|
|
sub server_portfilename {
|
|
my ($piddir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.port';
|
|
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for server log file.
|
|
#
|
|
sub server_logfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.log';
|
|
$trailer = '_stunnel.log' if(lc($proto) =~ /^(ftp|http|imap|pop3|smtp)s$/);
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for server commands file.
|
|
#
|
|
sub server_cmdfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.cmd';
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for server input file.
|
|
#
|
|
sub server_inputfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.input';
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for server output file.
|
|
#
|
|
sub server_outputfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
my $trailer = '_server.output';
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return filename for a server executable
|
|
#
|
|
sub server_exe {
|
|
my ($name, $ext) = @_;
|
|
if(!defined $ext) {
|
|
$ext = 'SRV';
|
|
}
|
|
my $cmd;
|
|
if($ENV{'CURL_TEST_BUNDLES'}) {
|
|
$cmd = $SRVDIR . "servers" . exe_ext($ext) . " $name";
|
|
}
|
|
else {
|
|
$cmd = $SRVDIR . $name . exe_ext($ext);
|
|
}
|
|
return "$cmd";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return filename for a server executable as an argument list
|
|
#
|
|
sub server_exe_args {
|
|
my ($name, $ext) = @_;
|
|
if(!defined $ext) {
|
|
$ext = 'SRV';
|
|
}
|
|
my @cmd;
|
|
if($ENV{'CURL_TEST_BUNDLES'}) {
|
|
@cmd = ($SRVDIR . "servers" . exe_ext($ext), $name);
|
|
}
|
|
else {
|
|
@cmd = ($SRVDIR . $name . exe_ext($ext));
|
|
}
|
|
return @cmd;
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for main or primary sockfilter pid file.
|
|
#
|
|
sub mainsockf_pidfilename {
|
|
my ($piddir, $proto, $ipver, $idnum) = @_;
|
|
die "unsupported protocol: '$proto'" unless($proto &&
|
|
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
|
|
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid';
|
|
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for main or primary sockfilter log file.
|
|
#
|
|
sub mainsockf_logfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
die "unsupported protocol: '$proto'" unless($proto &&
|
|
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
|
|
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log':'_sockfilt.log';
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for data or secondary sockfilter pid file.
|
|
#
|
|
sub datasockf_pidfilename {
|
|
my ($piddir, $proto, $ipver, $idnum) = @_;
|
|
die "unsupported protocol: '$proto'" unless($proto &&
|
|
(lc($proto) =~ /^ftps?$/));
|
|
my $trailer = '_sockdata.pid';
|
|
return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# Return file name for data or secondary sockfilter log file.
|
|
#
|
|
sub datasockf_logfilename {
|
|
my ($logdir, $proto, $ipver, $idnum) = @_;
|
|
die "unsupported protocol: '$proto'" unless($proto &&
|
|
(lc($proto) =~ /^ftps?$/));
|
|
my $trailer = '_sockdata.log';
|
|
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
|
}
|
|
|
|
|
|
#***************************************************************************
|
|
# End of library
|
|
1;
|