]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: tighten up perl exports
authorDan Fandrich <dan@coneharvesters.com>
Wed, 5 Apr 2023 22:29:00 +0000 (15:29 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 11 Apr 2023 21:55:31 +0000 (14:55 -0700)
This reduces namespace pollution a little.

Ref: #10818

tests/convsrctest.pl
tests/ftpserver.pl
tests/http-server.pl
tests/keywords.pl
tests/pathhelp.pm
tests/rtspserver.pl
tests/runtests.pl
tests/serverhelp.pm
tests/sshhelp.pm
tests/tftpserver.pl

index 34504bafd7999a8a80f6d44694ff0e6a58dca61e..fad922823ca7ad68984bfeb4a7690f375e41e9e6 100755 (executable)
 use strict;
 use warnings;
 
-use getpart;
+use getpart qw(
+    getpart
+    loadtest
+    fulltest
+    );
 
 # Boilerplate code for test tool
 my $head =
index fd87f8eb45cc8b89d8ca41115f962fcfc74d1ba4..4a4fc7726bc0df3edabf14315fe7b6da67f6a731 100755 (executable)
@@ -59,7 +59,13 @@ use Digest::MD5;
 use File::Basename;
 
 use directories;
-use getpart;
+
+use getpart qw(
+    getpartattr
+    getpart
+    loadtest
+    );
+
 use processhelp;
 
 use serverhelp qw(
@@ -72,7 +78,7 @@ use serverhelp qw(
     datasockf_logfilename
     );
 
-use sshhelp qw(
+use pathhelp qw(
     exe_ext
     );
 
index b96e7e9e483d9c50bce10a72e62f49043bbc3847..153020300b508d3f0c7c11dc73db7b57857ddb22 100755 (executable)
@@ -38,7 +38,7 @@ use serverhelp qw(
     server_logfilename
     );
 
-use sshhelp qw(
+use pathhelp qw(
     exe_ext
     );
 
index b62eb95a637e7fb4f278de662af655ac37e56dd5..eb9f86830bc9a07fcf5d029b60605a4230e01a9a 100755 (executable)
@@ -29,7 +29,10 @@ use warnings;
 push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
 push(@INC, ".");
 
-use getpart; # array functions
+use getpart qw(
+    getpart
+    loadtest
+    );
 
 my $srcdir = $ENV{'srcdir'} || '.';
 my $TESTDIR="$srcdir/data";
index 5f67d6431ff33a0bea7b398dba9d3053b3275707..db7fdc2764a5831c2a6798eb68b28eee32a765af 100644 (file)
@@ -61,6 +61,7 @@ BEGIN {
     our @EXPORT = qw(
       sys_native_abs_path
       sys_native_path
+      exe_ext
     );
 
     our @EXPORT_OK = qw(
@@ -779,5 +780,22 @@ sub simple_transform_win32_to_unix {
     $path = '/cygdrive' . $path if(drives_mounted_on_cygdrive());
     return $path;
 }
+#
+#***************************************************************************
+# Return file extension for executable files on this operating system
+#
+sub exe_ext {
+    my ($component, @arr) = @_;
+    if ($ENV{'CURL_TEST_EXE_EXT'}) {
+        return $ENV{'CURL_TEST_EXE_EXT'};
+    }
+    if ($ENV{'CURL_TEST_EXE_EXT_'.$component}) {
+        return $ENV{'CURL_TEST_EXE_EXT_'.$component};
+    }
+    if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' ||
+        $^O eq 'dos' || $^O eq 'os2') {
+        return '.exe';
+    }
+}
 
 1;    # End of module
index 4e5d0a0f0087f4ed5a1850083cbd2b0e99fa3263..3282d9c231ea2ee664860490f70f9b05a7c0e469 100755 (executable)
@@ -36,7 +36,7 @@ use serverhelp qw(
     server_logfilename
     );
 
-use sshhelp qw(
+use pathhelp qw(
     exe_ext
     );
 
index bad53736d9b0698dc128e9fbe8f30a8808370239..b4af9e25eed755201cd8535539f2c1c6bab8a725 100755 (executable)
@@ -98,22 +98,16 @@ use serverhelp qw(
 use sshhelp qw(
     $hstpubmd5f
     $hstpubsha256f
-    $sshdexe
     $sshexe
     $sftpexe
-    $sshconfig
     $sftpconfig
     $sshdlog
-    $sshlog
     $sftplog
     $sftpcmds
     display_sshdconfig
-    display_sshconfig
     display_sftpconfig
     display_sshdlog
-    display_sshlog
     display_sftplog
-    exe_ext
     find_sshd
     find_ssh
     find_sftp
index e1b4ff690aa00ee589e954400a0041c44e5d358a..bc5439ce217f51b28df1dcc4c629cc1da54b351d 100644 (file)
@@ -27,39 +27,26 @@ package serverhelp;
 use strict;
 use warnings;
 
-#***************************************************************************
-# Global symbols allowed without explicit package name
-#
-use vars qw(
-    @EXPORT_OK
-    );
-
-
-#***************************************************************************
-# Inherit Exporter's capabilities
-#
-use base qw(Exporter);
-
-
-#***************************************************************************
-# Global symbols this module will export upon request
-#
-@EXPORT_OK = qw(
-    serverfactors
-    servername_id
-    servername_str
-    servername_canon
-    server_pidfilename
-    server_portfilename
-    server_logfilename
-    server_cmdfilename
-    server_inputfilename
-    server_outputfilename
-    mainsockf_pidfilename
-    mainsockf_logfilename
-    datasockf_pidfilename
-    datasockf_logfilename
+BEGIN {
+    use base qw(Exporter);
+
+    our @EXPORT_OK = qw(
+        serverfactors
+        servername_id
+        servername_str
+        servername_canon
+        server_pidfilename
+        server_portfilename
+        server_logfilename
+        server_cmdfilename
+        server_inputfilename
+        server_outputfilename
+        mainsockf_pidfilename
+        mainsockf_logfilename
+        datasockf_pidfilename
+        datasockf_logfilename
     );
+}
 
 
 #***************************************************************************
index 43e8dd5d25ad1d0a557937432821eb2cc402a5f0..d6a32f58955a23c7173d30ba4f952ccedf43c407 100644 (file)
@@ -26,116 +26,83 @@ package sshhelp;
 
 use strict;
 use warnings;
-use File::Spec;
-
 
-#***************************************************************************
-# Global symbols allowed without explicit package name
-#
-use vars qw(
-    @EXPORT_OK
-    $sshdexe
-    $sshexe
-    $sftpsrvexe
-    $sftpexe
-    $sshkeygenexe
-    $httptlssrvexe
-    $sshdconfig
-    $sshconfig
-    $sftpconfig
-    $knownhosts
-    $sshdlog
-    $sshlog
-    $sftplog
-    $sftpcmds
-    $hstprvkeyf
-    $hstpubkeyf
-    $hstpubmd5f
-    $hstpubsha256f
-    $cliprvkeyf
-    $clipubkeyf
-    @sftppath
-    @httptlssrvpath
+BEGIN {
+    use base qw(Exporter);
+
+    our @EXPORT_OK = qw(
+        $sshdexe
+        $sshexe
+        $sftpsrvexe
+        $sftpexe
+        $sshkeygenexe
+        $sshdconfig
+        $sshconfig
+        $sftpconfig
+        $knownhosts
+        $sshdlog
+        $sshlog
+        $sftplog
+        $sftpcmds
+        $hstprvkeyf
+        $hstpubkeyf
+        $hstpubmd5f
+        $hstpubsha256f
+        $cliprvkeyf
+        $clipubkeyf
+        display_sshdconfig
+        display_sshconfig
+        display_sftpconfig
+        display_sshdlog
+        display_sshlog
+        display_sftplog
+        dump_array
+        find_sshd
+        find_ssh
+        find_sftpsrv
+        find_sftp
+        find_sshkeygen
+        find_httptlssrv
+        logmsg
+        sshversioninfo
     );
+}
 
+use File::Spec;
 
-#***************************************************************************
-# Inherit Exporter's capabilities
-#
-use base qw(Exporter);
-
-
-#***************************************************************************
-# Global symbols this module will export upon request
-#
-@EXPORT_OK = qw(
-    $sshdexe
-    $sshexe
-    $sftpsrvexe
-    $sftpexe
-    $sshkeygenexe
-    $sshdconfig
-    $sshconfig
-    $sftpconfig
-    $knownhosts
-    $sshdlog
-    $sshlog
-    $sftplog
-    $sftpcmds
-    $hstprvkeyf
-    $hstpubkeyf
-    $hstpubmd5f
-    $hstpubsha256f
-    $cliprvkeyf
-    $clipubkeyf
-    display_sshdconfig
-    display_sshconfig
-    display_sftpconfig
-    display_sshdlog
-    display_sshlog
-    display_sftplog
-    dump_array
+use pathhelp qw(
     exe_ext
-    find_sshd
-    find_ssh
-    find_sftpsrv
-    find_sftp
-    find_sshkeygen
-    find_httptlssrv
-    logmsg
-    sshversioninfo
     );
 
-
 #***************************************************************************
 # Global variables initialization
 #
-$sshdexe         = 'sshd'        .exe_ext('SSH'); # base name and ext of ssh daemon
-$sshexe          = 'ssh'         .exe_ext('SSH'); # base name and ext of ssh client
-$sftpsrvexe      = 'sftp-server' .exe_ext('SSH'); # base name and ext of sftp-server
-$sftpexe         = 'sftp'        .exe_ext('SSH'); # base name and ext of sftp client
-$sshkeygenexe    = 'ssh-keygen'  .exe_ext('SSH'); # base name and ext of ssh-keygen
-$httptlssrvexe   = 'gnutls-serv' .exe_ext('SSH'); # base name and ext of gnutls-serv
-$sshdconfig      = 'curl_sshd_config';       # ssh daemon config file
-$sshconfig       = 'curl_ssh_config';        # ssh client config file
-$sftpconfig      = 'curl_sftp_config';       # sftp client config file
-$sshdlog         = undef;                    # ssh daemon log file
-$sshlog          = undef;                    # ssh client log file
-$sftplog         = undef;                    # sftp client log file
-$sftpcmds        = 'curl_sftp_cmds';         # sftp client commands batch file
-$knownhosts      = 'curl_client_knownhosts'; # ssh knownhosts file
-$hstprvkeyf      = 'curl_host_rsa_key';      # host private key file
-$hstpubkeyf      = 'curl_host_rsa_key.pub';  # host public key file
-$hstpubmd5f      = 'curl_host_rsa_key.pub_md5';  # md5 hash of host public key
-$hstpubsha256f   = 'curl_host_rsa_key.pub_sha256';  # sha256 hash of host public key
-$cliprvkeyf      = 'curl_client_key';        # client private key file
-$clipubkeyf      = 'curl_client_key.pub';    # client public key file
+our $sshdexe         = 'sshd'        .exe_ext('SSH'); # base name and ext of ssh daemon
+our $sshexe          = 'ssh'         .exe_ext('SSH'); # base name and ext of ssh client
+our $sftpsrvexe      = 'sftp-server' .exe_ext('SSH'); # base name and ext of sftp-server
+our $sftpexe         = 'sftp'        .exe_ext('SSH'); # base name and ext of sftp client
+our $sshkeygenexe    = 'ssh-keygen'  .exe_ext('SSH'); # base name and ext of ssh-keygen
+our $httptlssrvexe   = 'gnutls-serv' .exe_ext('SSH'); # base name and ext of gnutls-serv
+our $sshdconfig      = 'curl_sshd_config';       # ssh daemon config file
+our $sshconfig       = 'curl_ssh_config';        # ssh client config file
+our $sftpconfig      = 'curl_sftp_config';       # sftp client config file
+our $sshdlog         = undef;                    # ssh daemon log file
+our $sshlog          = undef;                    # ssh client log file
+our $sftplog         = undef;                    # sftp client log file
+our $sftpcmds        = 'curl_sftp_cmds';         # sftp client commands batch file
+our $knownhosts      = 'curl_client_knownhosts'; # ssh knownhosts file
+our $hstprvkeyf      = 'curl_host_rsa_key';      # host private key file
+our $hstpubkeyf      = 'curl_host_rsa_key.pub';  # host public key file
+our $hstpubmd5f      = 'curl_host_rsa_key.pub_md5';  # md5 hash of host public key
+our $hstpubsha256f   = 'curl_host_rsa_key.pub_sha256';  # sha256 hash of host public key
+our $cliprvkeyf      = 'curl_client_key';        # client private key file
+our $clipubkeyf      = 'curl_client_key.pub';    # client public key file
 
 
 #***************************************************************************
 # Absolute paths where to look for sftp-server plugin, when not in PATH
 #
-@sftppath = qw(
+our @sftppath = qw(
     /usr/lib/openssh
     /usr/libexec/openssh
     /usr/libexec
@@ -161,7 +128,7 @@ $clipubkeyf      = 'curl_client_key.pub';    # client public key file
 #***************************************************************************
 # Absolute paths where to look for httptlssrv (gnutls-serv), when not in PATH
 #
-@httptlssrvpath = qw(
+our @httptlssrvpath = qw(
     /usr/sbin
     /usr/libexec
     /usr/lib
@@ -182,24 +149,6 @@ $clipubkeyf      = 'curl_client_key.pub';    # client public key file
     );
 
 
-#***************************************************************************
-# Return file extension for executable files on this operating system
-#
-sub exe_ext {
-    my ($component, @arr) = @_;
-    if ($ENV{'CURL_TEST_EXE_EXT'}) {
-        return $ENV{'CURL_TEST_EXE_EXT'};
-    }
-    if ($ENV{'CURL_TEST_EXE_EXT_'.$component}) {
-        return $ENV{'CURL_TEST_EXE_EXT_'.$component};
-    }
-    if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' ||
-        $^O eq 'dos' || $^O eq 'os2') {
-        return '.exe';
-    }
-}
-
-
 #***************************************************************************
 # Create or overwrite the given file with lines from an array of strings
 #
index e1a696b0a25515aa43f11f0be42ea8d5dcff90c0..52ad01f0c22cb4e9066c302637e7434b49e2d8cf 100755 (executable)
 #
 #***************************************************************************
 
+use strict;
+use warnings;
+
 BEGIN {
     push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
     push(@INC, ".");
 }
 
-use strict;
-use warnings;
-
 use serverhelp qw(
     server_pidfilename
     server_logfilename
     );
 
-use sshhelp qw(
+use pathhelp qw(
     exe_ext
     );