equal
deleted
inserted
replaced
10 # Symbian Foundation Ltd - initial contribution. |
10 # Symbian Foundation Ltd - initial contribution. |
11 # Mike Kinghan, mikek@symbian.org |
11 # Mike Kinghan, mikek@symbian.org |
12 # |
12 # |
13 # Contributors: |
13 # Contributors: |
14 # Brendan Donegan, brendand@symbian.org |
14 # Brendan Donegan, brendand@symbian.org |
|
15 # Maciej Seroka, maciejs@symbian.org |
15 # |
16 # |
16 # Description: |
17 # Description: |
17 # This is a tool for setting the name of an ATS test drop, and/or the build id |
18 # This is a tool for setting the name of an ATS test drop, and/or the build id |
18 # of the build being tested, and/or the name of the device on which |
19 # of the build being tested, and/or the name of the device on which |
19 # it is to be run, by modifying the XML test drop specificcation. |
20 # it is to be run, by modifying the XML test drop specificcation. |
36 my $zipper; # Zip command, depending on whether zip or 7z is available. |
37 my $zipper; # Zip command, depending on whether zip or 7z is available. |
37 my $unzipper; # Unzip command, depending on whether [unzip or 7z is available. |
38 my $unzipper; # Unzip command, depending on whether [unzip or 7z is available. |
38 my $xml_in; # Name of the input xml file. Always 'test.xml' if extracted from zipped test drop. |
39 my $xml_in; # Name of the input xml file. Always 'test.xml' if extracted from zipped test drop. |
39 my $temp_dest_name; # Leafname of temporary output file, if $destfile undefined. |
40 my $temp_dest_name; # Leafname of temporary output file, if $destfile undefined. |
40 my $publish; # Publishing folder for ats reports. |
41 my $publish; # Publishing folder for ats reports. |
|
42 my $bld_drive; # Subst'd drive |
41 |
43 |
42 sub usage($); |
44 sub usage($); |
43 sub help(); |
45 sub help(); |
44 sub usage_error(); |
46 sub usage_error(); |
45 sub silent_command($); |
47 sub silent_command($); |
48 'host-name' => \$host_name, |
50 'host-name' => \$host_name, |
49 'build-id' => \$build_id, |
51 'build-id' => \$build_id, |
50 'src' => \$srcfile, |
52 'src' => \$srcfile, |
51 'dest' => \$destfile, |
53 'dest' => \$destfile, |
52 'help' => \$help, |
54 'help' => \$help, |
53 'publish' => \$publish); |
55 'publish' => \$publish, |
|
56 'bld-drive' => \$bld_drive); |
54 |
57 |
55 GetOptions(\%optmap, |
58 GetOptions(\%optmap, |
56 'test-drop-name=s', |
59 'test-drop-name=s', |
57 'host-name=s', |
60 'host-name=s', |
58 'build-id=s', |
61 'build-id=s', |
59 'src=s', |
62 'src=s', |
60 'dest=s', |
63 'dest=s', |
61 'help!', |
64 'help!', |
62 'publish=s') |
65 'publish=s', |
|
66 'bld-drive=s') |
63 or usage_error(); |
67 or usage_error(); |
64 |
68 |
65 # Check if Tie::File module installed |
69 # Check if Tie::File module installed |
66 eval("use Tie::File"); |
70 eval("use Tie::File"); |
67 if ($@) { $publish = '' }; |
71 if ($@) { $publish = ''; $bld_drive = ''; }; |
68 |
72 |
69 if ($help) { |
73 if ($help) { |
70 help(); |
74 help(); |
71 } |
75 } |
72 |
76 |
169 } |
173 } |
170 $current_line++; |
174 $current_line++; |
171 } |
175 } |
172 untie @lines; |
176 untie @lines; |
173 } |
177 } |
|
178 if ($bld_drive) { #Replace D:\ATS\winscw_smoketest path with subst'd drive |
|
179 my @LINE; |
|
180 tie @LINE, 'Tie::File', "test.xml" or die("Cannot tie file \"test.xml\". $!\n"); |
|
181 for (@LINE) { |
|
182 s/D:\\ATS\\winscw_smoketest/$bld_drive/g; |
|
183 } |
|
184 untie @LINE; |
|
185 } |
174 if ( -f "$destfile.zip") { |
186 if ( -f "$destfile.zip") { |
175 unlink("$destfile.zip") or die("Could not delete \"$destfile.zip\": $!\n"); |
187 unlink("$destfile.zip") or die("Could not delete \"$destfile.zip\": $!\n"); |
176 } |
188 } |
177 copy("$srcfile","$destfile.zip") or die("Could not copy \"$srcfile\" -> \"$destfile.zip\": $!\n"); |
189 copy("$srcfile","$destfile.zip") or die("Could not copy \"$srcfile\" -> \"$destfile.zip\": $!\n"); |
178 system("$zipper > $dev_null") and die("Could not zip \"test.xml\" into \"$destfile\"\n"); |
190 system("$zipper > $dev_null") and die("Could not zip \"test.xml\" into \"$destfile\"\n"); |