runtests: assume Time::HiRes, drop Perl Win32 dependency

`Time::HiRes` was already used unconditionally before this patch in
`servers.pm`. This package, and functions used by runtests (`sleep` and
`gettimeofday`) are supported by the minimum Perl version required for
curl:

https://perldoc.perl.org/5.8.0/Time::HiRes

- Drop the `portable_sleep()` wrapper in favor of `Time::HiRes::sleep()`.
- Use `Time::HiRes` unconditionally in `serverhelp.pm`.
- Stop using the `Win32` package where available. It was included
  to provide a Windows fallback for `Time::HiRes::sleep()`. It was never
  actually called, but the dependency may have loaded `Win32.dll`, which
  often appears in failed fork operations in GHA logs.
  Ref: a6fed41f6f #5054 #5034
  Ref: https://github.com/curl/curl/discussions/14854

Closes #18287
This commit is contained in:
Viktor Szakats 2025-08-14 13:36:04 +02:00
parent c24d4be057
commit be01b60ce5
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 18 additions and 68 deletions

View file

@ -29,6 +29,8 @@ package serverhelp;
use strict;
use warnings;
use Time::HiRes;
BEGIN {
use base qw(Exporter);
@ -52,13 +54,6 @@ BEGIN {
datasockf_pidfilename
datasockf_logfilename
);
# sub second timestamping needs Time::HiRes
eval {
no warnings "all";
require Time::HiRes;
import Time::HiRes qw( gettimeofday );
}
}
use globalconfig;
@ -81,20 +76,10 @@ our $logfile; # server log file name, for logmsg
# 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);
}
my ($seconds, $usec) = Time::HiRes::gettimeofday();
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($seconds);
my $now = sprintf("%02d:%02d:%02d.%06d ", $hour, $min, $sec, $usec);
# 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);