This commit is contained in:
Viktor Szakats 2025-02-28 16:40:30 +00:00 committed by GitHub
commit 2fa6e0088c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 9 additions and 116 deletions

View File

@ -329,7 +329,6 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
run: | run: |
/c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
- name: 'run tests' - name: 'run tests'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }} if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
@ -479,7 +478,6 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
run: | run: |
/c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
- name: 'downgrade msys2-runtime' - name: 'downgrade msys2-runtime'
@ -891,7 +889,6 @@ jobs:
if [[ '${{ matrix.name }}' != *'gnutls'* ]]; then if [[ '${{ matrix.name }}' != *'gnutls'* ]]; then
/c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel openssh || true /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel openssh || true
fi fi
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
- name: 'downgrade msys2-runtime' - name: 'downgrade msys2-runtime'

View File

@ -158,7 +158,7 @@ if [ "${TFLAGS}" != 'skipall' ] && \
time cmake --build _bld --config "${PRJ_CFG}" --target test-ci time cmake --build _bld --config "${PRJ_CFG}" --target test-ci
else else
( (
TFLAGS="-a -p !flaky -r -rm ${TFLAGS}" TFLAGS="-a -p !flaky -r ${TFLAGS}"
cd _bld/tests cd _bld/tests
time ./runtests.pl time ./runtests.pl
) )

View File

@ -107,7 +107,7 @@ curl_add_runtests(test-am "-a -am")
curl_add_runtests(test-full "-a -p -r") curl_add_runtests(test-full "-a -p -r")
# ~flaky means that it ignores results of tests using the flaky keyword # ~flaky means that it ignores results of tests using the flaky keyword
curl_add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent") curl_add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent")
curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r -rm -j20") curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r -j20")
curl_add_runtests(test-torture "-a -t -j20") curl_add_runtests(test-torture "-a -t -j20")
curl_add_runtests(test-event "-a -e") curl_add_runtests(test-event "-a -e")

View File

@ -145,7 +145,7 @@ TEST_E = -a -e
TEST_NF = -a -p ~flaky ~timing-dependent TEST_NF = -a -p ~flaky ~timing-dependent
# special CI target derived from nonflaky with CI-specific flags # special CI target derived from nonflaky with CI-specific flags
TEST_CI = $(TEST_NF) -r -rm -j20 TEST_CI = $(TEST_NF) -r -j20
PYTEST = pytest PYTEST = pytest
endif endif

View File

@ -47,7 +47,6 @@ BEGIN {
readtestkeywords readtestkeywords
restore_test_env restore_test_env
runner_init runner_init
runnerac_clearlocks
runnerac_shutdown runnerac_shutdown
runnerac_stopservers runnerac_stopservers
runnerac_test_preprocess runnerac_test_preprocess
@ -88,7 +87,6 @@ use processhelp qw(
); );
use servers qw( use servers qw(
checkcmd checkcmd
clearlocks
initserverconfig initserverconfig
serverfortest serverfortest
stopserver stopserver
@ -1275,12 +1273,6 @@ sub runner_test_run {
return (0, clearlogs(), \%testtimings, $cmdres, $CURLOUT, $tool, $usedvalgrind); return (0, clearlogs(), \%testtimings, $cmdres, $CURLOUT, $tool, $usedvalgrind);
} }
# Async call runner_clearlocks
# Called by controller
sub runnerac_clearlocks {
return controlleripccall(\&runner_clearlocks, @_);
}
# Async call runner_shutdown # Async call runner_shutdown
# This call does NOT generate an IPC response and must be the last IPC call # This call does NOT generate an IPC response and must be the last IPC call
# received. # received.
@ -1474,10 +1466,7 @@ sub ipcrecv {
# print "ipcrecv $funcname\n"; # print "ipcrecv $funcname\n";
# Synchronously call the desired function # Synchronously call the desired function
my @res; my @res;
if($funcname eq "runner_clearlocks") { if($funcname eq "runner_shutdown") {
@res = runner_clearlocks(@$argsarrayref);
}
elsif($funcname eq "runner_shutdown") {
runner_shutdown(@$argsarrayref); runner_shutdown(@$argsarrayref);
# Special case: no response will be forthcoming # Special case: no response will be forthcoming
return 1; return 1;
@ -1511,18 +1500,6 @@ sub ipcrecv {
return 0; return 0;
} }
###################################################################
# Kill the server processes that still have lock files in a directory
sub runner_clearlocks {
my ($lockdir)=@_;
if(clearlogs()) {
logmsg "Warning: log messages were lost\n";
}
clearlocks($lockdir);
return clearlogs();
}
################################################################### ###################################################################
# Kill all server processes # Kill all server processes
sub runner_stopservers { sub runner_stopservers {

View File

@ -219,11 +219,6 @@ Display run time statistics. (Requires the `Perl Time::HiRes` module)
Display full run time statistics. (Requires the `Perl Time::HiRes` module) Display full run time statistics. (Requires the `Perl Time::HiRes` module)
## `-rm`
Force removal of files by killing locking processes. (Windows only, requires
the **Sysinternals** `handle[64].exe` to be on PATH)
## `--repeat=[num]` ## `--repeat=[num]`
This repeats the given set of test numbers this many times. If no test numbers This repeats the given set of test numbers this many times. If no test numbers

View File

@ -160,7 +160,6 @@ my $globalabort; # flag signalling program abort
# values for $singletest_state # values for $singletest_state
use constant { use constant {
ST_INIT => 0, ST_INIT => 0,
ST_CLEARLOCKS => 1,
ST_INITED => 2, ST_INITED => 2,
ST_PREPROCESS => 3, ST_PREPROCESS => 3,
ST_RUN => 4, ST_RUN => 4,
@ -179,7 +178,6 @@ my %runnersrunning; # tests currently running by runner ID
my $short; my $short;
my $no_debuginfod; my $no_debuginfod;
my $keepoutfiles; # keep stdout and stderr files after tests my $keepoutfiles; # keep stdout and stderr files after tests
my $clearlocks; # force removal of files by killing locking processes
my $postmortem; # display detailed info about failed tests my $postmortem; # display detailed info about failed tests
my $run_disabled; # run the specific tests even if listed in DISABLED my $run_disabled; # run the specific tests even if listed in DISABLED
my $scrambleorder; my $scrambleorder;
@ -1837,33 +1835,13 @@ sub singletest {
if($singletest_state{$runnerid} == ST_INIT) { if($singletest_state{$runnerid} == ST_INIT) {
my $logdir = getrunnerlogdir($runnerid); my $logdir = getrunnerlogdir($runnerid);
# first, remove all lingering log & lock files # first, remove all lingering log & lock files
if((!cleardir($logdir) || !cleardir("$logdir/$LOCKDIR")) if(!cleardir($logdir)) {
&& $clearlocks) { logmsg "Warning: $runnerid: cleardir($logdir) failed\n";
# On Windows, lock files can't be deleted when the process still }
# has them open, so kill those processes first if(!cleardir("$logdir/$LOCKDIR")) {
if(runnerac_clearlocks($runnerid, "$logdir/$LOCKDIR")) { logmsg "Warning: $runnerid: cleardir($logdir/$LOCKDIR) failed\n";
logmsg "ERROR: runner $runnerid seems to have died\n";
$singletest_state{$runnerid} = ST_INIT;
return (-1, 0);
}
$singletest_state{$runnerid} = ST_CLEARLOCKS;
} else {
$singletest_state{$runnerid} = ST_INITED;
# Recursively call the state machine again because there is no
# event expected that would otherwise trigger a new call.
return singletest(@_);
} }
} elsif($singletest_state{$runnerid} == ST_CLEARLOCKS) {
my ($rid, $logs) = runnerar($runnerid);
if(!$rid) {
logmsg "ERROR: runner $runnerid seems to have died\n";
$singletest_state{$runnerid} = ST_INIT;
return (-1, 0);
}
logmsg $logs;
my $logdir = getrunnerlogdir($runnerid);
cleardir($logdir);
$singletest_state{$runnerid} = ST_INITED; $singletest_state{$runnerid} = ST_INITED;
# Recursively call the state machine again because there is no # Recursively call the state machine again because there is no
# event expected that would otherwise trigger a new call. # event expected that would otherwise trigger a new call.
@ -2422,10 +2400,6 @@ while(@ARGV) {
$fullstats=1; $fullstats=1;
} }
} }
elsif($ARGV[0] eq "-rm") {
# force removal of files by killing locking processes
$clearlocks=1;
}
elsif($ARGV[0] eq "-u") { elsif($ARGV[0] eq "-u") {
# error instead of warning on server unexpectedly alive # error instead of warning on server unexpectedly alive
$err_unexpected=1; $err_unexpected=1;
@ -2459,7 +2433,6 @@ Usage: runtests.pl [options] [test selection(s)]
-R scrambled order (uses the random seed, see --seed) -R scrambled order (uses the random seed, see --seed)
-r run time statistics -r run time statistics
-rf full run time statistics -rf full run time statistics
-rm force removal of files by killing locking processes (Windows only)
--repeat=[num] run the given tests this many times --repeat=[num] run the given tests this many times
-s short output -s short output
--seed=[num] set the random seed to a fixed number --seed=[num] set the random seed to a fixed number

View File

@ -54,7 +54,6 @@ BEGIN {
# functions # functions
qw( qw(
checkcmd checkcmd
clearlocks
serverfortest serverfortest
stopserver stopserver
stopservers stopservers
@ -265,54 +264,6 @@ sub init_serverpidfile_hash {
} }
#######################################################################
# Kill the processes that still have lock files in a directory
#
sub clearlocks {
my $dir = $_[0];
my $done = 0;
if(os_is_win()) {
$dir = sys_native_abs_path($dir);
# Must use backslashes for handle64 to find a match
if ($^O eq 'MSWin32') {
$dir =~ s/\//\\/g;
}
else {
$dir =~ s/\//\\\\/g;
}
my $handle = "handle";
if($ENV{"PROCESSOR_ARCHITECTURE"} =~ /64$/) {
$handle = "handle64";
}
if(checkcmd($handle)) {
# https://learn.microsoft.com/sysinternals/downloads/handle#usage
my $cmd = "$handle $dir -accepteula -nobanner";
logmsg "clearlocks: Executing query: '$cmd'\n";
my @handles = `$cmd`;
for my $tryhandle (@handles) {
# Skip the "No matching handles found." warning when returned
if($tryhandle =~ /^(\S+)\s+pid:\s+(\d+)\s+type:\s+(\w+)\s+([0-9A-F]+):\s+(.+)\r\r/) {
logmsg "clearlocks: Found $3 lock of '$5' ($4) by $1 ($2)\n";
# Ignore stunnel since we cannot do anything about its locks
if("$3" eq "File" && "$1" ne "tstunnel.exe") {
logmsg "clearlocks: Killing IMAGENAME eq $1 and PID eq $2\n";
# https://ss64.com/nt/taskkill.html
my $cmd = "taskkill.exe -f -t -fi \"IMAGENAME eq $1\" -fi \"PID eq $2\" >nul 2>&1";
logmsg "clearlocks: Executing kill: '$cmd'\n";
system($cmd);
$done = 1;
}
}
}
}
else {
logmsg "Warning: 'handle' tool not found.\n";
}
}
return $done;
}
####################################################################### #######################################################################
# Check if a given child process has just died. Reaps it if so. # Check if a given child process has just died. Reaps it if so.
# #