author | Shabe Razvi <shaber@symbian.org> |
Wed, 26 May 2010 13:46:40 +0100 | |
changeset 1047 | ee03efed9e3c |
parent 1028 | 11f25704ec27 |
child 1085 | 461755d25d57 |
permissions | -rw-r--r-- |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
2 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
8 |
# |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
11 |
# Mike Kinghan, mikek@symbian.org |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
12 |
# |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
13 |
# Contributors: |
550
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
14 |
# Brendan Donegan, brendand@symbian.org |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
15 |
# Maciej Seroka, maciejs@symbian.org |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
16 |
# |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
17 |
# Description: |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
18 |
# This is a tool for setting the name of an ATS test drop, and/or the build id |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
19 |
# of the build being tested, and/or the name of the device on which |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
20 |
# it is to be run, by modifying the XML test drop specificcation. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
21 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
22 |
use strict; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
23 |
use Getopt::Long; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
24 |
use XML::Simple; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
25 |
use File::Copy; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
26 |
use Data::Dumper; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
27 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
28 |
my $test_drop_name; # Test drop name to be embedded in output XML |
550
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
29 |
my $build_id; # Build ID to be embedded in output XML |
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
30 |
my $host_name; # Host name to be embedded in output XML |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
31 |
my $srcfile; # Input test drop file, either .xml or .zip |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
32 |
my $destfile; # Leafname for output file. Extension will be .xml or .zip as input. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
33 |
# If unspecified then the input file is updated. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
34 |
my $help; # Do help? |
550
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
35 |
my $srctype; # Type of input file, .xml or .zip |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
36 |
my $dev_null = $^O =~ /^MSWin/ ? "nul" : "/dev/null"; # OS-dependent nul device. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
37 |
my $zipper; # Zip command, depending on whether zip or 7z is available. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
38 |
my $unzipper; # Unzip command, depending on whether [unzip or 7z is available. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
39 |
my $xml_in; # Name of the input xml file. Always 'test.xml' if extracted from zipped test drop. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
40 |
my $temp_dest_name; # Leafname of temporary output file, if $destfile undefined. |
820
2a9e6403efaf
Updated postbuild to publish smoketest results
Maciej Seroka <maciejs@symbian.org>
parents:
819
diff
changeset
|
41 |
my $publish; # Publishing folder for ats reports. |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
42 |
my $bld_drive; # Subst'd drive |
989
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
43 |
my $test_target; # The target which the tests will be run on |
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
44 |
my $image_path; # The path to the ROM image used for testing (not valid for WINSCW target) |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
45 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
46 |
sub usage($); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
47 |
sub help(); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
48 |
sub usage_error(); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
49 |
sub silent_command($); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
50 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
51 |
my %optmap = ( 'test-drop-name' => \$test_drop_name, |
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
52 |
'host-name' => \$host_name, |
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
53 |
'build-id' => \$build_id, |
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
54 |
'src' => \$srcfile, |
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
55 |
'dest' => \$destfile, |
820
2a9e6403efaf
Updated postbuild to publish smoketest results
Maciej Seroka <maciejs@symbian.org>
parents:
819
diff
changeset
|
56 |
'help' => \$help, |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
57 |
'publish' => \$publish, |
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
58 |
'bld-drive' => \$bld_drive, |
989
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
59 |
'image-path' => \$image_path); |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
60 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
61 |
GetOptions(\%optmap, |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
62 |
'test-drop-name=s', |
550
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
63 |
'host-name=s', |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
64 |
'build-id=s', |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
65 |
'src=s', |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
66 |
'dest=s', |
820
2a9e6403efaf
Updated postbuild to publish smoketest results
Maciej Seroka <maciejs@symbian.org>
parents:
819
diff
changeset
|
67 |
'help!', |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
68 |
'publish=s', |
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
69 |
'bld-drive=s', |
989
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
70 |
'image-path=s') |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
71 |
or usage_error(); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
72 |
|
821
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
73 |
# Check if Tie::File module installed |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
74 |
eval("use Tie::File"); |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
75 |
if ($@) { $publish = ''; $bld_drive = ''; }; |
821
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
76 |
|
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
77 |
if ($help) { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
78 |
help(); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
79 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
80 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
81 |
# --src is mandatory. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
82 |
usage_error(), unless (defined($srcfile)); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
83 |
if ($srcfile =~ /(\.xml$)/i) { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
84 |
$srctype = lc($1); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
85 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
86 |
elsif ($srcfile =~ /(\.zip$)/i) { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
87 |
$srctype = lc($1); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
88 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
89 |
else { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
90 |
# src file must have extension .xml or .zip |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
91 |
usage_error(); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
92 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
93 |
die("File \"$srcfile\" does not exist"), unless -f $srcfile; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
94 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
95 |
if (!$destfile) { # dest file unspecified. We will update the src file. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
96 |
$temp_dest_name = "ats_specialise_test_drop.out"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
97 |
$destfile = $temp_dest_name; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
98 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
99 |
else { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
100 |
# If dest file has same extension as src then strip off, cos we'll append it anyway. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
101 |
$destfile =~ s/$srctype$//; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
102 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
103 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
104 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
105 |
if ($srctype =~ /^\.zip$/) { # Test drop is zip. Must contain test.xml. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
106 |
$xml_in = "test.xml"; # This is our input XML. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
107 |
if ( -f $xml_in) { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
108 |
# Pre-emptively delete anystale xml file. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
109 |
unlink($xml_in) or die("Cannot delete stale $xml_in: $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
110 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
111 |
if (!silent_command("zip -v")) { # See if we've got zip |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
112 |
$zipper = "zip -m $destfile.zip test.xml"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
113 |
$unzipper = "unzip -o $srcfile $xml_in -d ."; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
114 |
} |
279 | 115 |
elsif (!silent_command("7z -h")) { # Else see if we've got 7zip |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
116 |
$zipper = "7z u $destfile.zip test.xml"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
117 |
$unzipper = "7z e $srcfile $xml_in"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
118 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
119 |
else { # Got no archiver. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
120 |
die ("Need programs zip/unzip or 7z. Not found\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
121 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
122 |
# Extract test.xml from zip. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
123 |
system("$unzipper > $dev_null") and die("Could not unzip \"$srcfile\"\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
124 |
die("Did not find $xml_in within \"$srcfile\"\n"), unless( -f "$xml_in"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
125 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
126 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
127 |
else { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
128 |
$xml_in = $srcfile; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
129 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
130 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
131 |
# Parse the input XML into hashref. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
132 |
my $test_drop = XMLin("./$xml_in", keeproot => 1, |
1006
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
133 |
forcearray => [ 'name', 'id', 'owner', 'priority', 'buildid', 'postAction', 'type', 'target', 'device', 'property', 'command', 'param', 'plan', 'session', 'set', 'alias' ],# |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
134 |
keyattr => [] ); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
135 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
136 |
# Insert the specified test drop name, if any. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
137 |
$test_drop->{'test'}->{'name'}->[0] = $test_drop_name, if $test_drop_name; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
138 |
# Insert the specified build id, if any. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
139 |
$test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id; |
989
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
140 |
# Insert the path to the ROM image |
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
141 |
if ($image_path) { |
1006
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
142 |
my $set_params; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
143 |
my $flash_params; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
144 |
foreach $set_params (@{$test_drop->{'test'}->{'plan'}->[0]->{'session'}->[0]->{'set'}}) { |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
145 |
$test_target = $set_params->{'target'}->[0]->{'device'}->[0]->{'alias'}; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
146 |
$set_params->{'flash'}->[0]; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
147 |
$flash_params = $set_params->{'flash'}; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
148 |
$flash_params->[0] = { 'target-alias' => $test_target, 'images' => $image_path }; |
75c9a2f0ae9e
Modified ats_specialise_test_drop to automatically set test-target param based on device alias
Maciej Seroka <maciejs@symbian.org>
parents:
993
diff
changeset
|
149 |
} |
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
150 |
} |
989
95924ae2e0d6
Added ROM image parameters to ats_specialise_drop
Brendan Donegan <brendand@symbian.org>
parents:
836
diff
changeset
|
151 |
|
819
3df98b3b0a8d
Updated ats_specialise_test_drop.pl to insert FileStoreAction param
Maciej Seroka <maciejs@symbian.org>
parents:
730
diff
changeset
|
152 |
# Insert the FileStoreAction parameter |
820
2a9e6403efaf
Updated postbuild to publish smoketest results
Maciej Seroka <maciejs@symbian.org>
parents:
819
diff
changeset
|
153 |
my $postaction_params = $test_drop->{'test'}->{'postAction'}->[0]->{'params'}->{'param'}, if $publish; |
821
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
154 |
$postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish; |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
155 |
|
991
f2c5bb4624be
Fixed ats_specialise_drop to insert ROM image parameters
Maciej Seroka <maciejs@symbian.org>
parents:
989
diff
changeset
|
156 |
if ($host_name) { # Also insert specified host name |
730 | 157 |
my $devices = $test_drop->{'test'}->{'target'}->[0]->{'device'}; |
158 |
||
159 |
foreach my $device (@{$devices}) { |
|
160 |
my $device_properties = $device->{'property'}; |
|
161 |
my $num_properties = @{$device_properties}; |
|
162 |
||
163 |
$device_properties->[$num_properties] = { 'name' => "HOST", 'value' => "$host_name" }; |
|
164 |
$device->{'property'} = $device_properties; |
|
165 |
} |
|
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
166 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
167 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
168 |
if ($srctype =~ /^\.xml$/i ) { # Input file was XML |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
169 |
# Write new XML to dest file. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
170 |
open OUT,">$destfile.xml" or die("Cannot open file \"$destfile.xml\" for writing. $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
171 |
print OUT XMLout($test_drop, keeproot => 1); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
172 |
close OUT; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
173 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
174 |
else { #Input file was a zip. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
175 |
# Write new XML to test.xml |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
176 |
open OUT,">test.xml" or die("Cannot open file \"test.xml\" for writing. $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
177 |
print OUT XMLout($test_drop, keeproot => 1); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
178 |
close OUT; |
821
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
179 |
if ($publish) { #Move <type>FileStoreAction</type> above <params> |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
180 |
my @lines; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
181 |
tie @lines, 'Tie::File', "test.xml" or die("Cannot tie file \"test.xml\". $!\n"); |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
182 |
my $current_line = 0; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
183 |
for (@lines) { |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
184 |
if (/FileStoreAction/) { |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
185 |
my $line_to_move = @lines[$current_line]; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
186 |
splice @lines, $current_line, 1; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
187 |
splice @lines, $current_line-4, 0, $line_to_move; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
188 |
last; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
189 |
} |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
190 |
$current_line++; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
191 |
} |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
192 |
untie @lines; |
b24df46a3102
Implemented exporting Smoke Test Report to Diamonds
Maciej Seroka <maciejs@symbian.org>
parents:
820
diff
changeset
|
193 |
} |
836
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
194 |
if ($bld_drive) { #Replace D:\ATS\winscw_smoketest path with subst'd drive |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
195 |
my @LINE; |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
196 |
tie @LINE, 'Tie::File', "test.xml" or die("Cannot tie file \"test.xml\". $!\n"); |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
197 |
for (@LINE) { |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
198 |
s/D:\\ATS\\winscw_smoketest/$bld_drive/g; |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
199 |
} |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
200 |
untie @LINE; |
675529c38614
Added smoke test for making a connection to a web server through ethernet
Maciej Seroka <maciejs@symbian.org>
parents:
823
diff
changeset
|
201 |
} |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
202 |
if ( -f "$destfile.zip") { |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
203 |
unlink("$destfile.zip") or die("Could not delete \"$destfile.zip\": $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
204 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
205 |
copy("$srcfile","$destfile.zip") or die("Could not copy \"$srcfile\" -> \"$destfile.zip\": $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
206 |
system("$zipper > $dev_null") and die("Could not zip \"test.xml\" into \"$destfile\"\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
207 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
208 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
209 |
if ($temp_dest_name) { # We are to update the src file. dest file is a temporary. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
210 |
# Delete src file |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
211 |
unlink($srcfile) or die("Cannot delete file \"$srcfile\" to replace: $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
212 |
# Replace with temporary. |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
213 |
move("$destfile$srctype","$srcfile") or die("Could not move \"$destfile$srctype\" -> \"$srcfile\": $!\n"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
214 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
215 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
216 |
print "OK\n"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
217 |
exit 0; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
218 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
219 |
sub usage($) |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
220 |
{ |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
221 |
my $error = shift; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
222 |
my $fh = $error == 0 ? *STDOUT : *STDERR; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
223 |
print $fh "ats_specialise_test_drop.pl\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
224 |
"Specify the name, build id and target device in an ATS XML test drop\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
225 |
"synopsis:\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
226 |
" ats_specialise_test_drop.pl --help\n" . |
550
4128d08e7c08
Changed ats_specialise_testdrop and build.test.xml to use the 'HOST' device property to fix the devicem rather than the 'NAME' property
Brendan Donegan brendand@symbian.org
parents:
317
diff
changeset
|
227 |
" ats_specialise_test_drop.pl [--test-drop-name=TESTNAME] [--build-id=BUILDID] [--host-name=HOSTNAME] [--dest=FILE] --src=FILE \n" . |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
228 |
"options:\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
229 |
" --help Display this help and exit\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
230 |
" --test-drop-name=TESTNAME TESTNAME is the desired name of the test drop. If not specified then the test drop name is not modified.\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
231 |
" --build-id=BUILDID BUILDID is id of the build being tested. If not specified then the build id is not modified.\n" . |
639
9b547c4a9812
ATS target 'sf-build-smoketestpkg' - fix for argument name change in 'ats_specialise_test_drop.pl'. Update command-line help for 'ats_specialise_test_drop.pl'
MattD <mattd@symbian.org>
parents:
550
diff
changeset
|
232 |
" --host-name=HOSTNAME HOSTNAME is the name of the ATS worker on which the test should be run. " . |
134
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
233 |
"If not specified then the test device name is not modified.\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
234 |
" --src=INFILE INFILE is the file containing the test drop XML to be modified, or else a zip file " . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
235 |
" containing the test drop XML in the file 'test.xml'. INFILE must have extension .xml or.zip\n" . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
236 |
" --dest=OUTFILE The modified output will be written to the file OUTFILE.EXT " . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
237 |
"where EXT is same extention, .xml or .zip, found on INFILE. " . |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
238 |
"If OUTFILE is not specified then INFILE is modified\n"; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
239 |
exit $error; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
240 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
241 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
242 |
sub help() |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
243 |
{ |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
244 |
usage(0); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
245 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
246 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
247 |
sub usage_error() |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
248 |
{ |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
249 |
usage(1); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
250 |
} |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
251 |
|
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
252 |
sub silent_command($) |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
253 |
{ |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
254 |
my $cmd = shift; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
255 |
system("$cmd 1> $dev_null 2>&1"); |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
256 |
return $? >> 8; |
039d0b7e56f3
Comments and code tidying for ats3_testdrop.pl
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
257 |
} |