tests: factor out the test server management code

This now lives in servers.pm with some configuration variables moved to
globalconfig.pm

Ref: #10818
This commit is contained in:
Dan Fandrich 2023-04-05 17:26:20 -07:00
parent a2ce734e28
commit d39db81192
5 changed files with 3094 additions and 2883 deletions

View File

@ -27,12 +27,12 @@ PDFPAGES = testcurl.pdf runtests.pdf
MANDISTPAGES = runtests.1.dist testcurl.1.dist
EXTRA_DIST = appveyor.pm azure.pm badsymbols.pl check-deprecated.pl CMakeLists.txt \
dictserver.py directories.pm disable-scan.pl error-codes.pl extern-scan.pl \
FILEFORMAT.md processhelp.pm ftpserver.pl getpart.pm http-server.pl http2-server.pl \
dictserver.py directories.pm disable-scan.pl error-codes.pl extern-scan.pl FILEFORMAT.md \
processhelp.pm ftpserver.pl getpart.pm globalconfig.pm http-server.pl http2-server.pl \
http3-server.pl manpage-scan.pl manpage-syntax.pl markdown-uppercase.pl mem-include-scan.pl \
memanalyze.pl negtelnetserver.py nroff-scan.pl option-check.pl options-scan.pl \
pathhelp.pm README.md rtspserver.pl runtests.1 runtests.pl secureserver.pl \
serverhelp.pm smbserver.py sshhelp.pm sshserver.pl stunnel.pem symbol-scan.pl \
serverhelp.pm servers.pm smbserver.py sshhelp.pm sshserver.pl stunnel.pem symbol-scan.pl \
testcurl.1 testcurl.pl tftpserver.pl util.py valgrind.pm valgrind.supp version-scan.pl
DISTCLEANFILES = configurehelp.pm

76
tests/globalconfig.pm Normal file
View File

@ -0,0 +1,76 @@
#***************************************************************************
# _ _ ____ _
# 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 module contains global variables used in multiple modules in the test
# harness but not really "owned" by any one.
package globalconfig;
use strict;
use warnings;
BEGIN {
use base qw(Exporter);
our @EXPORT = qw(
$CURL
$FTPDCMD
$LOGDIR
$perl
$PIDDIR
$proxy_address
$srcdir
$torture
$VCURL
$verbose
@protocols
);
}
use pathhelp qw(exe_ext);
#######################################################################
# global configuration variables
#
# config variables overridden by command-line options
our $verbose; # 1 to show verbose test output
our $torture; # 1 to enable torture testing
our $proxy_address; # external HTTP proxy address
# paths
our $srcdir = $ENV{'srcdir'} || '.'; # root of the test source code
our $perl="perl -I$srcdir"; # invoke perl like this
our $LOGDIR="log"; # root of the log directory
our $PIDDIR = "$LOGDIR/server"; # root of the server directory with PID files
our $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy server instructions here
our $CURL="../src/curl".exe_ext('TOOL'); # what curl binary to run on the tests
our $VCURL=$CURL; # what curl binary to use to verify the servers with
# VCURL is handy to set to the system one when the one you
# just built hangs or crashes and thus prevent verification
# other config variables
our @protocols; # array of lowercase supported protocol servers
1;

View File

@ -58,20 +58,16 @@ use Cwd 'abs_path';
BEGIN {
use base qw(Exporter);
our @EXPORT = qw(
sys_native_abs_path
sys_native_path
exe_ext
);
our @EXPORT_OK = qw(
build_sys_abs_path
sys_native_current_path
normalize_path
os_is_win
$use_cygpath
should_use_cygpath
drives_mounted_on_cygdrive
os_is_win
exe_ext
sys_native_abs_path
sys_native_current_path
build_sys_abs_path
normalize_path
$use_cygpath
should_use_cygpath
drives_mounted_on_cygdrive
);
}

File diff suppressed because it is too large Load Diff

2956
tests/servers.pm Normal file

File diff suppressed because it is too large Load Diff