Merge 752740c82e into e7751571eb
This commit is contained in:
commit
2fa6e0088c
3
.github/workflows/windows.yml
vendored
3
.github/workflows/windows.yml
vendored
@ -329,7 +329,6 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
/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'
|
||||
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
|
||||
@ -479,7 +478,6 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
/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
|
||||
|
||||
- name: 'downgrade msys2-runtime'
|
||||
@ -891,7 +889,6 @@ jobs:
|
||||
if [[ '${{ matrix.name }}' != *'gnutls'* ]]; then
|
||||
/c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel openssh || true
|
||||
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
|
||||
|
||||
- name: 'downgrade msys2-runtime'
|
||||
|
||||
@ -158,7 +158,7 @@ if [ "${TFLAGS}" != 'skipall' ] && \
|
||||
time cmake --build _bld --config "${PRJ_CFG}" --target test-ci
|
||||
else
|
||||
(
|
||||
TFLAGS="-a -p !flaky -r -rm ${TFLAGS}"
|
||||
TFLAGS="-a -p !flaky -r ${TFLAGS}"
|
||||
cd _bld/tests
|
||||
time ./runtests.pl
|
||||
)
|
||||
|
||||
@ -107,7 +107,7 @@ curl_add_runtests(test-am "-a -am")
|
||||
curl_add_runtests(test-full "-a -p -r")
|
||||
# ~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-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-event "-a -e")
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ TEST_E = -a -e
|
||||
TEST_NF = -a -p ~flaky ~timing-dependent
|
||||
|
||||
# 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
|
||||
endif
|
||||
|
||||
@ -47,7 +47,6 @@ BEGIN {
|
||||
readtestkeywords
|
||||
restore_test_env
|
||||
runner_init
|
||||
runnerac_clearlocks
|
||||
runnerac_shutdown
|
||||
runnerac_stopservers
|
||||
runnerac_test_preprocess
|
||||
@ -88,7 +87,6 @@ use processhelp qw(
|
||||
);
|
||||
use servers qw(
|
||||
checkcmd
|
||||
clearlocks
|
||||
initserverconfig
|
||||
serverfortest
|
||||
stopserver
|
||||
@ -1275,12 +1273,6 @@ sub runner_test_run {
|
||||
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
|
||||
# This call does NOT generate an IPC response and must be the last IPC call
|
||||
# received.
|
||||
@ -1474,10 +1466,7 @@ sub ipcrecv {
|
||||
# print "ipcrecv $funcname\n";
|
||||
# Synchronously call the desired function
|
||||
my @res;
|
||||
if($funcname eq "runner_clearlocks") {
|
||||
@res = runner_clearlocks(@$argsarrayref);
|
||||
}
|
||||
elsif($funcname eq "runner_shutdown") {
|
||||
if($funcname eq "runner_shutdown") {
|
||||
runner_shutdown(@$argsarrayref);
|
||||
# Special case: no response will be forthcoming
|
||||
return 1;
|
||||
@ -1511,18 +1500,6 @@ sub ipcrecv {
|
||||
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
|
||||
sub runner_stopservers {
|
||||
|
||||
@ -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)
|
||||
|
||||
## `-rm`
|
||||
|
||||
Force removal of files by killing locking processes. (Windows only, requires
|
||||
the **Sysinternals** `handle[64].exe` to be on PATH)
|
||||
|
||||
## `--repeat=[num]`
|
||||
|
||||
This repeats the given set of test numbers this many times. If no test numbers
|
||||
|
||||
@ -160,7 +160,6 @@ my $globalabort; # flag signalling program abort
|
||||
# values for $singletest_state
|
||||
use constant {
|
||||
ST_INIT => 0,
|
||||
ST_CLEARLOCKS => 1,
|
||||
ST_INITED => 2,
|
||||
ST_PREPROCESS => 3,
|
||||
ST_RUN => 4,
|
||||
@ -179,7 +178,6 @@ my %runnersrunning; # tests currently running by runner ID
|
||||
my $short;
|
||||
my $no_debuginfod;
|
||||
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 $run_disabled; # run the specific tests even if listed in DISABLED
|
||||
my $scrambleorder;
|
||||
@ -1837,33 +1835,13 @@ sub singletest {
|
||||
if($singletest_state{$runnerid} == ST_INIT) {
|
||||
my $logdir = getrunnerlogdir($runnerid);
|
||||
# first, remove all lingering log & lock files
|
||||
if((!cleardir($logdir) || !cleardir("$logdir/$LOCKDIR"))
|
||||
&& $clearlocks) {
|
||||
# On Windows, lock files can't be deleted when the process still
|
||||
# has them open, so kill those processes first
|
||||
if(runnerac_clearlocks($runnerid, "$logdir/$LOCKDIR")) {
|
||||
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(@_);
|
||||
if(!cleardir($logdir)) {
|
||||
logmsg "Warning: $runnerid: cleardir($logdir) failed\n";
|
||||
}
|
||||
if(!cleardir("$logdir/$LOCKDIR")) {
|
||||
logmsg "Warning: $runnerid: cleardir($logdir/$LOCKDIR) failed\n";
|
||||
}
|
||||
|
||||
} 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;
|
||||
# Recursively call the state machine again because there is no
|
||||
# event expected that would otherwise trigger a new call.
|
||||
@ -2422,10 +2400,6 @@ while(@ARGV) {
|
||||
$fullstats=1;
|
||||
}
|
||||
}
|
||||
elsif($ARGV[0] eq "-rm") {
|
||||
# force removal of files by killing locking processes
|
||||
$clearlocks=1;
|
||||
}
|
||||
elsif($ARGV[0] eq "-u") {
|
||||
# error instead of warning on server unexpectedly alive
|
||||
$err_unexpected=1;
|
||||
@ -2459,7 +2433,6 @@ Usage: runtests.pl [options] [test selection(s)]
|
||||
-R scrambled order (uses the random seed, see --seed)
|
||||
-r 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
|
||||
-s short output
|
||||
--seed=[num] set the random seed to a fixed number
|
||||
|
||||
@ -54,7 +54,6 @@ BEGIN {
|
||||
# functions
|
||||
qw(
|
||||
checkcmd
|
||||
clearlocks
|
||||
serverfortest
|
||||
stopserver
|
||||
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.
|
||||
#
|
||||
|
||||
Loading…
Reference in New Issue
Block a user