From e7c144f1d1ba8e26eb3c044597cd7a1ffe8959bb Mon Sep 17 00:00:00 2001
From: Marc Hoersken <info@marc-hoersken.de>
Date: Tue, 3 Mar 2020 20:05:58 +0100
Subject: [PATCH] ci/tests: fix escaping of testnames and disable proxy for CI
 APIs

Follow up to ada581f and c0d8b96
Closes #5031
---
 tests/appveyor.pm | 11 +++++++----
 tests/azure.pm    | 11 +++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/tests/appveyor.pm b/tests/appveyor.pm
index 6ed83dd22..4906d2c8c 100644
--- a/tests/appveyor.pm
+++ b/tests/appveyor.pm
@@ -35,8 +35,11 @@ sub appveyor_check_environment {
 
 sub appveyor_create_test_result {
     my ($testnum, $testname)=@_;
+    $testname =~ s/\\/\\\\/g;
+    $testname =~ s/\'/\\\'/g;
+    $testname =~ s/\"/\\\"/g;
     my $appveyor_baseurl="$ENV{'APPVEYOR_API_URL'}";
-    my $appveyor_result=`curl --silent \\
+    my $appveyor_result=`curl --silent --noproxy "*" \\
     --header "Content-Type: application/json" \\
     --data "
         {
@@ -80,7 +83,7 @@ sub appveyor_update_test_result {
         $appveyor_category = 'Error';
     }
     my $appveyor_baseurl="$ENV{'APPVEYOR_API_URL'}";
-    my $appveyor_result=`curl --silent --request PUT \\
+    my $appveyor_result=`curl --silent --noproxy "*" --request PUT \\
     --header "Content-Type: application/json" \\
     --data "
         {
@@ -94,11 +97,11 @@ sub appveyor_update_test_result {
     "$appveyor_baseurl/api/tests"`;
     print $appveyor_result;
     if($appveyor_category eq 'Error') {
-        $appveyor_result=`curl --silent \\
+        $appveyor_result=`curl --silent --noproxy "*" \\
         --header "Content-Type: application/json" \\
         --data "
             {
-                'message': '$testname',
+                'message': '$testname $appveyor_outcome',
                 'category': '$appveyor_category',
                 'details': 'Test $testnum $appveyor_outcome'
             }
diff --git a/tests/azure.pm b/tests/azure.pm
index 94fe995d9..9dcb56c78 100644
--- a/tests/azure.pm
+++ b/tests/azure.pm
@@ -38,7 +38,7 @@ sub azure_check_environment {
 
 sub azure_create_test_run {
     my $azure_baseurl="$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
-    my $azure_run=`curl --silent \\
+    my $azure_run=`curl --silent --noproxy "*" \\
     --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
     --header "Content-Type: application/json" \\
     --data "
@@ -57,8 +57,11 @@ sub azure_create_test_run {
 
 sub azure_create_test_result {
     my ($azure_run_id, $testnum, $testname)=@_;
+    $testname =~ s/\\/\\\\/g;
+    $testname =~ s/\'/\\\'/g;
+    $testname =~ s/\"/\\\"/g;
     my $azure_baseurl="$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
-    my $azure_result=`curl --silent \\
+    my $azure_result=`curl --silent --noproxy "*" \\
     --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
     --header "Content-Type: application/json" \\
     --data "
@@ -101,7 +104,7 @@ sub azure_update_test_result {
         $azure_outcome = 'Failed';
     }
     my $azure_baseurl="$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
-    my $azure_result=`curl --silent --request PATCH \\
+    my $azure_result=`curl --silent --noproxy "*" --request PATCH \\
     --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
     --header "Content-Type: application/json" \\
     --data "
@@ -125,7 +128,7 @@ sub azure_update_test_result {
 sub azure_update_test_run {
     my ($azure_run_id)=@_;
     my $azure_baseurl="$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
-    my $azure_run=`curl --silent --request PATCH \\
+    my $azure_run=`curl --silent --noproxy "*" --request PATCH \\
     --header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
     --header "Content-Type: application/json" \\
     --data "