common/tools/ats/ats3_testdrop.pl
author Simon Howkins <simonh@symbian.org>
Mon, 05 Oct 2009 10:20:32 +0100
changeset 578 75fa4158340a
parent 139 7f5b4e3699cb
permissions -rw-r--r--
Fixed handling or regular expression strings, so the regular expression functiuonality works, not just substring detection! Added special handling if the severity marker is "ignore". Unsuprisingly, it ignores that line.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/perl
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
     2
113
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     4
# This component and the accompanying materials are made available
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     6
# which accompanies this distribution, and is available
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     8
#
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
     9
# Initial Contributors:
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    11
#   Mike Kinghan, mikek@symbian.org
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    12
#
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    13
# Contributors:
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    14
#
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    15
# Description:
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    16
#   This is a tool for sending an ATS testdrop to an ATS server.
113
7f0174848f99 Adding license boilerplate to perl scripts.
Mike Kinghan <mikek@symbian.org>
parents: 105
diff changeset
    17
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    18
use strict;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    19
use Getopt::Long;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    20
use File::Copy;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    21
use File::Spec;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    22
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    23
my $username = "admin"; # ATS server user name
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    24
my $password = "admin"; # ATS server password
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    25
my $host;   # ATS server hostname
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    26
my $schedule;   # Schedule string for test drop, if any
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    27
my $host_drop_path; # Directory path on the ATS server where the test drop will be placed.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    28
                    # This must be physically the same path as $local_drop_path, via drive mapping. 
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    29
my $local_drop_path; # Local directory path where the test drop will be placed.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    30
                    # This must be physically the same path as $host_drop_path, via drive mapping.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    31
my $local_test_pkg; # Local pathname of the test drop (zip or xml file). The test drop will be
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    32
                    # copied from here to $local_drop_path to make it accessible on the server,
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    33
                    # unless $local_test_pkg begins with "...". This indicates the test drop is already
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    34
                    # present in $local_drop_path and does need to be copied there. The remainder
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    35
                    # following "..." is the filename of the test drop.    
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    36
my $help;
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    37
my $dev_null = $^O =~ /^MSWin/ ? "nul" : "/dev/null";
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    38
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    39
sub usage($);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    40
sub help();
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    41
sub usage_error();
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    42
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    43
my %optmap = (  'host' => \$host,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    44
			    'local-test-pkg' => \$local_test_pkg,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    45
				'host-drop-path' => \$host_drop_path,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    46
				'local-drop-path' =>\$local_drop_path,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    47
				'username' => \$username,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    48
				'password' => \$password,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    49
				'schedule' => \$schedule,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    50
                'help' => \$help);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    51
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    52
GetOptions(\%optmap,
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    53
          'host=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    54
          'local-test-pkg=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    55
          'host-drop-path=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    56
          'local-drop-path=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    57
          'username=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    58
          'password=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    59
          'schedule=s',
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    60
          'help!') 
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    61
          or usage_error();
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    62
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    63
if ($help) {
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    64
	help();
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    65
}
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    66
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    67
usage_error(), unless (defined($host) && defined($local_test_pkg) && defined($local_drop_path) && defined($host_drop_path));
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    68
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    69
my $curl_version = `curl --version 1> $dev_null 2>&1`;
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    70
die("Need program \"curl\". Not found"), if ($?);
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    71
die("Test drop path \"$local_drop_path\" not found"), unless ( -d "$local_drop_path");
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    72
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    73
$host .= ":8080", unless ($host =~ /:\d+$/);
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    74
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    75
my ($vol,$dir,$pkg);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    76
my $local_test_drop;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    77
my $host_test_drop;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    78
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    79
if ($local_test_pkg =~ /^\.\.\.(.+)/ ) { # Local test package name begins with "...". No need to copy. 
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    80
    $pkg = $1; # Get the filename of the test package.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    81
    # Compose the full name of the test drop within the local drop path.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    82
    $local_test_drop = File::Spec->catfile($local_drop_path,$pkg);    
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    83
    die("Test package file \"$local_test_drop\" not found"), unless ( -f "$local_test_drop");        
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    84
}
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    85
else { # Local test package must be copied to local drop path.
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    86
    die("Test package file \"$local_test_pkg\" not found"), unless ( -f "$local_test_pkg");
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    87
    # Compose the full name of the test drop within the local drop path.    
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    88
    ($vol,$dir,$pkg) = File::Spec->splitpath($local_test_pkg);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    89
    $local_test_drop = File::Spec->catfile($local_drop_path,$pkg);
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    90
    if ( -f "$local_test_drop") {
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    91
        # A state test drop of the same name exists. Delete.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    92
        unlink($local_test_drop) or die("Can't delete stale test drop \"$local_test_drop\". $!");
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    93
        print("A stale test drop \"$local_test_drop\" existed. Deleted\n");
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    94
    }
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    95
    # Copy the test drop to the local drop path.
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    96
    copy("$local_test_pkg","$local_test_drop")
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
    97
        or die("Cannot copy \"$local_test_pkg\" -> \"$local_test_drop\". $!");
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
    98
}
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
    99
# Compose the full name of the test drop within the host drop path.
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   100
$host_test_drop = File::Spec->catfile($host_drop_path,$pkg);
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   101
# Compose URL to notify server of test drop, requesting run.
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
   102
my $url ="http://$host/ats3/XTestRunExecute.do?username=$username&password=$password&testrunpath=$host_test_drop";
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
   103
$url .= "&schedule=$schedule", if (defined($schedule));
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   104
# Post URL to server with cURL.
99
2c7b53b5228f Add ATS test client target <sf-send-testpkg> to default configuration. Default is off.
Shabe Razvi <shaber@symbian.org>
parents: 91
diff changeset
   105
my $curl_cmd = "curl \"$url\"";
139
7f5b4e3699cb Fixed typo. $-sign should have been &
Mike Kinghan <mikek@symbian.org>
parents: 134
diff changeset
   106
my $curl_response = `$curl_cmd 2>&1`;
134
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   107
die("\nTest drop failed: $!\n"), if ($?);
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   108
if ($curl_response =~ /(TEST_RUN_REF_ID=\d+)/) {
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   109
    #extract test run id from cURL response.
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   110
    print "$1\n";
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   111
}
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   112
else {
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   113
    print "$curl_response\n";
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   114
    die("Test drop failed\n");
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   115
} 
039d0b7e56f3 Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents: 113
diff changeset
   116
print("Test drop done\n");
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   117
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   118
exit 0;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   119
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   120
sub usage($)
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   121
{
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   122
    my $error = shift;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   123
    my $fh = $error == 0 ? *STDOUT : *STDERR;
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   124
    print $fh "ats3_testdrop.pl\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   125
            "Send a test drop to an ATS3 server for execution\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   126
            "usage:\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   127
            "  ats3_testdrop.pl --help\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   128
            "  ats3_testdrop.pl --host=HOSTNAME --local-test-pkg=PKGFILE --local-drop-path=LOCALPATH " .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   129
                " --host-drop-path=HOSTPATH " .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   130
                "[--username=ATS3USERNAME] [--password=ATS3PASSWORD] [--schedule=DD.MM.YYYY-HH:MM]\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   131
            "options:\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   132
            "  --help                        Display this help and exit\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   133
            "  --host=HOSTAME                HOSTNAME is ATS3 server\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   134
            "  --local-test-pkg=PKGFILE      PKGFILE is the test package.\n" .
105
3aef06ac7a6a Fixed minor bug in ats3_testdrop.pl: Quote marks within quotation needed to be escaped.
Mike Kinghan <mikek@symbian.org>
parents: 99
diff changeset
   135
            "                                If PKGFILE begins \"...\" a filename in LOCALPATH is assumed\n" .
91
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   136
            "  --local-drop-path=LOCALPATH   Path to local directory where PKGFILE will be dropped\n" .            
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   137
            "  --host-drop-path=HOSTPATH     Host directory that is mapped to LOCALPATH.\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   138
            "                                Must agree with the properties of the registered device that the test package nominates\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   139
            "  --username=ATS3USERNAME       ATS3 user to whome the test will belong. Default=admin\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   140
            "  --password=ATS3PASSWORD       Password of ATS3 user. Default=admin\n" .
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   141
            "  --schedule=DD.MM.YYYY-HH:MM   Date-time at which test is to run. Default=as soon as possible\n";
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   142
    exit $error;            
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   143
}
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   144
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   145
sub help()
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   146
{
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   147
    usage(0);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   148
}
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   149
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   150
sub usage_error()
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   151
{
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   152
    usage(1);
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   153
}             
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   154
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   155
# EOF
786a0a00701e 1) Update binary packaging solution to invoke 7za directly. 2) Add partially complete ATS sf-send-testpkg target and associated tools
Shabe Razvi <shaber@symbian.org>
parents:
diff changeset
   156