From 1ff63dde7dff2292ec2d339c05244fe230677c0e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 13 Jun 2026 00:22:31 +0200 Subject: [PATCH] s2 --- tests/appveyor.pm | 12 ++++++------ tests/azure.pm | 16 ++++++++-------- tests/devtest.pl | 4 ++-- tests/processhelp.pm | 10 +++++----- tests/runner.pm | 2 +- tests/runtests.pl | 16 ++++++++-------- tests/sshhelp.pm | 2 +- tests/sshserver.pl | 4 ++-- tests/testcurl.pl | 6 +++--- tests/testutil.pm | 4 ++-- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/tests/appveyor.pm b/tests/appveyor.pm index 4a91af400e..b3f8df9b31 100644 --- a/tests/appveyor.pm +++ b/tests/appveyor.pm @@ -53,7 +53,7 @@ sub appveyor_create_test_result { $testname =~ s/\"/\\\"/g; $testname =~ s/\'/'"'"'/g; my $appveyor_baseurl = $ENV{'APPVEYOR_API_URL'}; - my $appveyor_result = `$curl --silent --noproxy '*' \\ + my $appveyor_result = qx($curl --silent --noproxy '*' \\ --header 'Content-Type: application/json' \\ --data ' { @@ -63,7 +63,7 @@ sub appveyor_create_test_result { "outcome": "Running" } ' \\ - '$appveyor_baseurl/api/tests'`; + '$appveyor_baseurl/api/tests'); print "AppVeyor API result: $appveyor_result\n" if($appveyor_result); $APPVEYOR_TEST_NAMES{$testnum} = $testname; } @@ -97,7 +97,7 @@ sub appveyor_update_test_result { $appveyor_category = 'Error'; } my $appveyor_baseurl = $ENV{'APPVEYOR_API_URL'}; - my $appveyor_result = `$curl --silent --noproxy '*' --request PUT \\ + my $appveyor_result = qx($curl --silent --noproxy '*' --request PUT \\ --header 'Content-Type: application/json' \\ --data ' { @@ -109,10 +109,10 @@ sub appveyor_update_test_result { "ErrorMessage": "Test $testnum $appveyor_outcome" } ' \\ - '$appveyor_baseurl/api/tests'`; + '$appveyor_baseurl/api/tests'); print "AppVeyor API result: $appveyor_result\n" if($appveyor_result); if($appveyor_category eq 'Error') { - $appveyor_result = `$curl --silent --noproxy '*' \\ + $appveyor_result = qx($curl --silent --noproxy '*' \\ --header 'Content-Type: application/json' \\ --data ' { @@ -121,7 +121,7 @@ sub appveyor_update_test_result { "details": "Test $testnum $appveyor_outcome" } ' \\ - '$appveyor_baseurl/api/build/messages'`; + '$appveyor_baseurl/api/build/messages'); print "AppVeyor API result: $appveyor_result\n" if($appveyor_result); } } diff --git a/tests/azure.pm b/tests/azure.pm index 0c9bccb2d4..e449a07fd4 100644 --- a/tests/azure.pm +++ b/tests/azure.pm @@ -55,7 +55,7 @@ sub azure_check_environment { sub azure_create_test_run { my ($curl) = @_; my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}"; - my $azure_run = `$curl --silent --noproxy "*" \\ + my $azure_run = qx($curl --silent --noproxy "*" \\ --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\ --header "Content-Type: application/json" \\ --data " @@ -65,7 +65,7 @@ sub azure_create_test_run { 'build': {'id': '$ENV{'BUILD_BUILDID'}'} } " \\ - "$azure_baseurl/_apis/test/runs?api-version=5.1"`; + "$azure_baseurl/_apis/test/runs?api-version=5.1"); if($azure_run =~ /"id":(\d+)/) { return $1; } @@ -79,7 +79,7 @@ sub azure_create_test_result { $testname =~ s/\'/'"'"'/g; my $title_testnum = sprintf("%04d", $testnum); my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}"; - my $azure_result = `$curl --silent --noproxy '*' \\ + my $azure_result = qx($curl --silent --noproxy '*' \\ --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\ --header 'Content-Type: application/json' \\ --data ' @@ -94,7 +94,7 @@ sub azure_create_test_result { } ] ' \\ - '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1'`; + '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1'); if($azure_result =~ /\[\{"id":(\d+)/) { return $1; } @@ -123,7 +123,7 @@ sub azure_update_test_result { $azure_outcome = 'Failed'; } my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}"; - my $azure_result = `$curl --silent --noproxy '*' --request PATCH \\ + my $azure_result = qx($curl --silent --noproxy '*' --request PATCH \\ --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\ --header "Content-Type: application/json" \\ --data ' @@ -137,7 +137,7 @@ sub azure_update_test_result { } ] ' \\ - '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1'`; + '$azure_baseurl/_apis/test/runs/$azure_run_id/results?api-version=5.1'); if($azure_result =~ /\[\{"id":(\d+)/) { return $1; } @@ -147,7 +147,7 @@ sub azure_update_test_result { sub azure_update_test_run { my ($curl, $azure_run_id) = @_; my $azure_baseurl = "$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}"; - my $azure_run = `$curl --silent --noproxy '*' --request PATCH \\ + my $azure_run = qx($curl --silent --noproxy '*' --request PATCH \\ --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\ --header 'Content-Type: application/json' \\ --data ' @@ -155,7 +155,7 @@ sub azure_update_test_run { "state": "Completed" } ' \\ - '$azure_baseurl/_apis/test/runs/$azure_run_id?api-version=5.1'`; + '$azure_baseurl/_apis/test/runs/$azure_run_id?api-version=5.1'); if($azure_run =~ /"id":(\d+)/) { return $1; } diff --git a/tests/devtest.pl b/tests/devtest.pl index 47a960a66c..b71689c857 100755 --- a/tests/devtest.pl +++ b/tests/devtest.pl @@ -69,7 +69,7 @@ use getpart; # This function is currently required to be here by servers.pm # This is copied from runtests.pl # -my $uname_release = `uname -r`; +my $uname_release = qx(uname -r); my $is_wsl = $uname_release =~ /Microsoft$/; sub logmsg { for(@_) { @@ -108,7 +108,7 @@ sub parseprotocols { # Initialize @protocols from the curl binary under test # sub init_protocols { - for (`$CURL -V 2>$dev_null`) { + for (qx($CURL -V 2>$dev_null)) { if(m/^Protocols: (.*)$/) { parseprotocols($1); } diff --git a/tests/processhelp.pm b/tests/processhelp.pm index 688c1808d2..37648bfc85 100644 --- a/tests/processhelp.pm +++ b/tests/processhelp.pm @@ -136,7 +136,7 @@ sub pidexists { } else { my $filter = "PID eq $pid"; # https://ss64.com/nt/tasklist.html - my $result = `tasklist -fi \"$filter\" 2>$dev_null`; + my $result = qx(tasklist -fi \"$filter\" 2>$dev_null); if(index($result, $pid) != -1) { return -$pid; } @@ -170,12 +170,12 @@ sub pidterm { Win32::Process::KillProcess($pid, 0); } else { # https://ss64.com/nt/tasklist.html - my $result = `tasklist -v -fo list -fi "PID eq $pid" 2>&1`; + my $result = qx(tasklist -v -fo list -fi "PID eq $pid" 2>&1); $result =~ s/\r//g; $result =~ s/\n/ | /g; print "Task info for $pid before taskkill: '$result'\n"; - $result = `powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"`; + $result = qx(powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"); $result =~ s/\r//g; print "Task child processes for $pid before taskkill:\n"; print "$result\n"; @@ -221,12 +221,12 @@ sub pidkill { Win32::Process::KillProcess($pid, 0); } else { # https://ss64.com/nt/tasklist.html - my $result = `tasklist -v -fo list -fi "PID eq $pid" 2>&1`; + my $result = qx(tasklist -v -fo list -fi "PID eq $pid" 2>&1); $result =~ s/\r//g; $result =~ s/\n/ | /g; print "Task info for $pid before taskkill: '$result'\n"; - $result = `powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"`; + $result = qx(powershell -Command "Get-CimInstance -ClassName Win32_Process -Filter 'ParentProcessId=$pid' | Select ProcessId,ParentProcessId,Name,CommandLine"); $result =~ s/\r//g; print "Task child processes for $pid before taskkill:\n"; print "$result\n"; diff --git a/tests/runner.pm b/tests/runner.pm index 72cca945e1..7dfbb8478d 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -714,7 +714,7 @@ sub singletest_precheck { # provide an environment variable $ENV{'CURL_TESTNUM'} = $testnum; - my @o = `$cmd 2> $LOGDIR/precheck-$testnum`; + my @o = qx($cmd 2> $LOGDIR/precheck-$testnum); if($o[0]) { $why = $o[0]; $why =~ s/[\r\n]//g; diff --git a/tests/runtests.pl b/tests/runtests.pl index c35f1bd237..6ad802f950 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -128,7 +128,7 @@ my $retry = 0; my $start; # time at which testing started my $args; # command-line arguments -my $uname_release = `uname -r`; +my $uname_release = qx(uname -r); my $is_wsl = $uname_release =~ /Microsoft$/; my $http_ipv6; # set if HTTP server has IPv6 support @@ -324,7 +324,7 @@ if(!$ENV{"NGHTTPX"}) { } if($ENV{"NGHTTPX"}) { my $cmd = "\"$ENV{'NGHTTPX'}\" -v 2>$dev_null"; - my $nghttpx_version = join(' ', `$cmd`); + my $nghttpx_version = join(' ', qx($cmd)); $nghttpx_h3 = $nghttpx_version =~ /nghttp3\//; chomp $nghttpx_h3; } @@ -413,10 +413,10 @@ sub showdiff { print $temp "\n"; } close($temp) || die "Failure writing diff file"; - my @out = `diff -u $file2 $file1 2>$dev_null`; + my @out = qx(diff -u $file2 $file1 2>$dev_null); if(!$out[0]) { - @out = `diff -c $file2 $file1 2>$dev_null`; + @out = qx(diff -c $file2 $file1 2>$dev_null); if(!$out[0]) { logmsg "Failed to show diff. The diff tool may be missing.\n"; } @@ -638,7 +638,7 @@ sub checksystemfeatures { $feature{"sshkeyalgo"} = ($ENV{'CURL_TEST_SSH_KEYALGO'} and $ENV{'CURL_TEST_SSH_KEYALGO'} =~ /^(?:rsa|ecdsa|ed25519)$/) ? $ENV{'CURL_TEST_SSH_KEYALGO'} : 'rsa'; # Detect simple cases of default libssh configuration files ending up - # setting `StrictHostKeyChecking no`. include files, quoted values, + # setting 'StrictHostKeyChecking no'. include files, quoted values, # '=value' format not implemented. $feature{"badlibssh"} = 0; foreach my $libssh_configfile (('/etc/ssh/ssh_config', $ENV{'HOME'} . '/.ssh/config')) { @@ -806,7 +806,7 @@ sub checksystemfeatures { # check if the HTTP server has it! my $cmd = server_exe('sws')." --version"; - my @sws = `$cmd`; + my @sws = qx($cmd); if($sws[0] =~ /IPv6/) { # HTTP server has IPv6 support! $http_ipv6 = 1; @@ -814,7 +814,7 @@ sub checksystemfeatures { # check if the FTP server has it! $cmd = server_exe('sockfilt')." --version"; - @sws = `$cmd`; + @sws = qx($cmd); if($sws[0] =~ /IPv6/) { # FTP server has IPv6 support! $ftp_ipv6 = 1; @@ -824,7 +824,7 @@ sub checksystemfeatures { if($feature{"UnixSockets"}) { # client has Unix sockets support, check whether the HTTP server has it my $cmd = server_exe('sws')." --version"; - my @sws = `$cmd`; + my @sws = qx($cmd); $http_unix = 1 if($sws[0] =~ /unix/); } diff --git a/tests/sshhelp.pm b/tests/sshhelp.pm index 41a2166261..2481de3278 100644 --- a/tests/sshhelp.pm +++ b/tests/sshhelp.pm @@ -342,7 +342,7 @@ sub find_sshkeygen { sub find_httptlssrv { my $p = find_exe_file_hpath($httptlssrvexe); if($p) { - my @o = `"$p" -l`; + my @o = qx("$p" -l); my $found; for(@o) { if(/Key exchange: SRP/) { diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 4133e86db6..743f6356de 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -677,7 +677,7 @@ sub sshd_supports_opt { ($sshdid =~ /SunSSH/)) { # ssh daemon supports command line options -t -f and -o $err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/, - `\"$sshd\" -t -f $sshdconfig_abs -o \"$option=$value\" 2>&1`; + qx(\"$sshd\" -t -f $sshdconfig_abs -o \"$option=$value\" 2>&1); return !$err; } if(($sshdid =~ /OpenSSH/) && ($sshdvernum >= 299)) { @@ -688,7 +688,7 @@ sub sshd_supports_opt { return 0; } $err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/, - `\"$sshd\" -t -f $sshdconfig_abs 2>&1`; + qx(\"$sshd\" -t -f $sshdconfig_abs 2>&1); unlink $sshdconfig; return !$err; } diff --git a/tests/testcurl.pl b/tests/testcurl.pl index f6f1f30d72..ae836e4411 100755 --- a/tests/testcurl.pl +++ b/tests/testcurl.pl @@ -418,7 +418,7 @@ if($git) { } # get the last 5 commits for show (even if no pull was made) - @commits = `git log --pretty=oneline --abbrev-commit -5`; + @commits = qx(git log --pretty=oneline --abbrev-commit -5); logit "The most recent curl git commits:"; for(@commits) { chomp ($_); @@ -441,7 +441,7 @@ if($git) { } # get the last 5 commits for show (even if no pull was made) - @commits = `git log --pretty=oneline --abbrev-commit -5`; + @commits = qx(git log --pretty=oneline --abbrev-commit -5); logit "The most recent ares git commits:"; for (@commits) { chomp ($_); @@ -547,7 +547,7 @@ chdir "$pwd/$build"; if($configurebuild) { # run configure script - print `$CURLDIR/configure $confopts 2>&1`; + print qx($CURLDIR/configure $confopts 2>&1); if(-f "lib/Makefile") { logit "configure seems to have finished fine"; diff --git a/tests/testutil.pm b/tests/testutil.pm index 5967355e8c..d337f71cde 100644 --- a/tests/testutil.pm +++ b/tests/testutil.pm @@ -223,10 +223,10 @@ sub runclient { # sub runclientoutput { my ($cmd) = @_; - return `$cmd 2>$dev_null`; + return qx($cmd 2>$dev_null); # This is one way to test curl on a remote machine -# my @out = `ssh $CLIENTIP cd \'$pwd\' \\; \'$cmd\'`; +# my @out = qx(ssh $CLIENTIP cd \'$pwd\' \\; \'$cmd\'); # sleep 2; # time to allow the NFS server to be updated # return @out; }