47 sub help(); |
47 sub help(); |
48 sub usage_error(); |
48 sub usage_error(); |
49 sub silent_command($); |
49 sub silent_command($); |
50 |
50 |
51 my %optmap = ( 'test-drop-name' => \$test_drop_name, |
51 my %optmap = ( 'test-drop-name' => \$test_drop_name, |
52 'host-name' => \$host_name, |
52 'host-name' => \$host_name, |
53 'build-id' => \$build_id, |
53 'build-id' => \$build_id, |
54 'src' => \$srcfile, |
54 'src' => \$srcfile, |
55 'dest' => \$destfile, |
55 'dest' => \$destfile, |
56 'help' => \$help, |
56 'help' => \$help, |
57 'publish' => \$publish, |
57 'publish' => \$publish, |
58 'bld-drive' => \$bld_drive, |
58 'bld-drive' => \$bld_drive, |
59 'test-target' => \$test_target, |
59 'test-target' => \$test_target, |
60 'image-path' => \$image_path); |
60 'image-path' => \$image_path); |
61 |
61 |
62 GetOptions(\%optmap, |
62 GetOptions(\%optmap, |
63 'test-drop-name=s', |
63 'test-drop-name=s', |
130 $xml_in = $srcfile; |
130 $xml_in = $srcfile; |
131 } |
131 } |
132 |
132 |
133 # Parse the input XML into hashref. |
133 # Parse the input XML into hashref. |
134 my $test_drop = XMLin("./$xml_in", keeproot => 1, |
134 my $test_drop = XMLin("./$xml_in", keeproot => 1, |
135 forcearray => [ 'name', 'id','owner','priority','buildid','postAction','type','target','device', 'property', 'command', 'param','plan'],# |
135 forcearray => [ 'name', 'id', 'owner', 'priority', 'buildid', 'postAction', 'type', 'target', 'device', 'property', 'command', 'param', 'plan'],# |
136 keyattr => [] ); |
136 keyattr => [] ); |
137 |
137 |
138 # Insert the specified test drop name, if any. |
138 # Insert the specified test drop name, if any. |
139 $test_drop->{'test'}->{'name'}->[0] = $test_drop_name, if $test_drop_name; |
139 $test_drop->{'test'}->{'name'}->[0] = $test_drop_name, if $test_drop_name; |
140 # Insert the specified build id, if any. |
140 # Insert the specified build id, if any. |
141 $test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id; |
141 $test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id; |
142 # Insert the path to the ROM image |
142 # Insert the path to the ROM image |
143 if $image_path { |
143 if ($image_path) { |
|
144 $test_drop->{'test'}->{'plan'}->[0]->{'flash'}->[0]; |
144 my $flash_params = $test_drop->{'test'}->{'plan'}->[0]->{'flash'}; |
145 my $flash_params = $test_drop->{'test'}->{'plan'}->[0]->{'flash'}; |
145 $flash_params->[1] = { 'target-alias' => $test_target, 'images' => $image_path }; |
146 $flash_params->[0] = { 'target-alias' => $test_target, 'images' => $image_path }; |
146 } |
147 } |
147 |
|
148 |
148 |
149 # Insert the FileStoreAction parameter |
149 # Insert the FileStoreAction parameter |
150 my $postaction_params = $test_drop->{'test'}->{'postAction'}->[0]->{'params'}->{'param'}, if $publish; |
150 my $postaction_params = $test_drop->{'test'}->{'postAction'}->[0]->{'params'}->{'param'}, if $publish; |
151 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish; |
151 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish; |
152 |
152 |
153 if ($host_name and (lc($test_target) ne "winscw") { # Also insert specified host name if target is WINSCW |
153 if ($host_name) { # Also insert specified host name |
154 my $devices = $test_drop->{'test'}->{'target'}->[0]->{'device'}; |
154 my $devices = $test_drop->{'test'}->{'target'}->[0]->{'device'}; |
155 |
155 |
156 foreach my $device (@{$devices}) { |
156 foreach my $device (@{$devices}) { |
157 my $device_properties = $device->{'property'}; |
157 my $device_properties = $device->{'property'}; |
158 my $num_properties = @{$device_properties}; |
158 my $num_properties = @{$device_properties}; |