}
-my %APPVEYOR_TEST_NAMES;
+my %APPVEYOR_TEST_NAMES; # JSON and shell-quoted test names by test number
sub appveyor_check_environment {
if(defined $ENV{'APPVEYOR_API_URL'} && $ENV{'APPVEYOR_API_URL'}) {
sub appveyor_create_test_result {
my ($curl, $testnum, $testname)=@_;
$testname =~ s/\\/\\\\/g;
- $testname =~ s/\'/\\\'/g;
$testname =~ s/\"/\\\"/g;
+ $testname =~ s/\'/'"'"'/g;
my $appveyor_baseurl="$ENV{'APPVEYOR_API_URL'}";
- my $appveyor_result=`$curl --silent --noproxy "*" \\
- --header "Content-Type: application/json" \\
- --data "
+ my $appveyor_result=`$curl --silent --noproxy '*' \\
+ --header 'Content-Type: application/json' \\
+ --data '
{
- 'testName': '$testname',
- 'testFramework': 'runtests.pl',
- 'fileName': 'tests/data/test$testnum',
- 'outcome': 'Running'
+ "testName": "$testname",
+ "testFramework": "runtests.pl",
+ "fileName": "tests/data/test$testnum",
+ "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;
}
$appveyor_category = 'Error';
}
my $appveyor_baseurl="$ENV{'APPVEYOR_API_URL'}";
- my $appveyor_result=`$curl --silent --noproxy "*" --request PUT \\
- --header "Content-Type: application/json" \\
- --data "
+ my $appveyor_result=`$curl --silent --noproxy '*' --request PUT \\
+ --header 'Content-Type: application/json' \\
+ --data '
{
- 'testName': '$testname',
- 'testFramework': 'runtests.pl',
- 'fileName': 'tests/data/test$testnum',
- 'outcome': '$appveyor_outcome',
- 'durationMilliseconds': $appveyor_duration,
- 'ErrorMessage': 'Test $testnum $appveyor_outcome'
+ "testName": "$testname",
+ "testFramework": "runtests.pl",
+ "fileName": "tests/data/test$testnum",
+ "outcome": "$appveyor_outcome",
+ "durationMilliseconds": $appveyor_duration,
+ "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 "*" \\
- --header "Content-Type: application/json" \\
- --data "
+ $appveyor_result=`$curl --silent --noproxy '*' \\
+ --header 'Content-Type: application/json' \\
+ --data '
{
- 'message': '$appveyor_outcome: $testname',
- 'category': '$appveyor_category',
- 'details': 'Test $testnum $appveyor_outcome'
+ "message": "$appveyor_outcome: $testname",
+ "category": "$appveyor_category",
+ "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);
}
}
sub azure_create_test_result {
my ($curl, $azure_run_id, $testnum, $testname)=@_;
$testname =~ s/\\/\\\\/g;
- $testname =~ s/\'/\\\'/g;
$testname =~ s/\"/\\\"/g;
+ $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=`$curl --silent --noproxy '*' \\
--header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
- --header "Content-Type: application/json" \\
- --data "
+ --header 'Content-Type: application/json' \\
+ --data '
[
{
- 'build': {'id': '$ENV{'BUILD_BUILDID'}'},
- 'testCase': {'id': $testnum},
- 'testCaseTitle': '$title_testnum: $testname',
- 'testCaseRevision': 2,
- 'automatedTestName': 'curl.tests.$testnum',
- 'outcome': 'InProgress'
+ "build": {"id": "$ENV{'BUILD_BUILDID'}"},
+ "testCase": {"id": $testnum},
+ "testCaseTitle": "$title_testnum: $testname",
+ "testCaseRevision": 2,
+ "automatedTestName": "curl.tests.$testnum",
+ "outcome": "InProgress"
}
]
- " \\
- "$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;
}
$azure_outcome = 'Failed';
}
my $azure_baseurl="$ENV{'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'}$ENV{'SYSTEM_TEAMPROJECTID'}";
- my $azure_result=`$curl --silent --noproxy "*" --request PATCH \\
+ my $azure_result=`$curl --silent --noproxy '*' --request PATCH \\
--header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
--header "Content-Type: application/json" \\
- --data "
+ --data '
[
{
- 'id': $azure_result_id,
- 'outcome': '$azure_outcome',
- 'startedDate': '$azure_start',
- 'completedDate': '$azure_complete',
- 'durationInMs': $azure_duration
+ "id": $azure_result_id,
+ "outcome": "$azure_outcome",
+ "startedDate": "$azure_start",
+ "completedDate": "$azure_complete",
+ "durationInMs": $azure_duration
}
]
- " \\
- "$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;
}
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=`$curl --silent --noproxy '*' --request PATCH \\
--header "Authorization: Bearer $ENV{'AZURE_ACCESS_TOKEN'}" \\
- --header "Content-Type: application/json" \\
- --data "
+ --header 'Content-Type: application/json' \\
+ --data '
{
- 'state': 'Completed'
+ "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;
}