common/tools/ats/ats_specialise_test_drop.pl
changeset 1006 75c9a2f0ae9e
parent 993 4ae26accd7da
child 1028 11f25704ec27
equal deleted inserted replaced
1005:a65c8f61a120 1006:75c9a2f0ae9e
    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,
       
    60                 'image-path' => \$image_path);
    59                 'image-path' => \$image_path);
    61 
    60 
    62 GetOptions(\%optmap,
    61 GetOptions(\%optmap,
    63           'test-drop-name=s',
    62           'test-drop-name=s',
    64           'host-name=s',
    63           'host-name=s',
    66           'src=s',
    65           'src=s',
    67           'dest=s',
    66           'dest=s',
    68           'help!',
    67           'help!',
    69           'publish=s', 
    68           'publish=s', 
    70           'bld-drive=s',
    69           'bld-drive=s',
    71           'test-target=s',
       
    72           'image-path=s') 
    70           'image-path=s') 
    73           or usage_error();
    71           or usage_error();
    74 
    72 
    75 # Check if Tie::File module installed
    73 # Check if Tie::File module installed
    76 eval("use Tie::File");
    74 eval("use Tie::File");
   130     $xml_in = $srcfile;
   128     $xml_in = $srcfile;
   131 }
   129 }
   132 
   130 
   133 # Parse the input XML into hashref.
   131 # Parse the input XML into hashref.
   134 my $test_drop = XMLin("./$xml_in", keeproot => 1,
   132 my $test_drop = XMLin("./$xml_in", keeproot => 1,
   135     forcearray => [ 'name', 'id', 'owner', 'priority', 'buildid', 'postAction', 'type', 'target', 'device', 'property', 'command', 'param', 'plan'],#
   133     forcearray => [ 'name', 'id', 'owner', 'priority', 'buildid', 'postAction', 'type', 'target', 'device', 'property', 'command', 'param', 'plan', 'session', 'set', 'alias' ],#
   136         keyattr => [] );
   134         keyattr => [] );
   137     
   135     
   138 # Insert the specified test drop name, if any.
   136 # Insert the specified test drop name, if any.
   139 $test_drop->{'test'}->{'name'}->[0] = $test_drop_name, if $test_drop_name;
   137 $test_drop->{'test'}->{'name'}->[0] = $test_drop_name, if $test_drop_name;
   140 # Insert the specified build id, if any.
   138 # Insert the specified build id, if any.
   141 $test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id;
   139 $test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id;
   142 # Insert the path to the ROM image
   140 # Insert the path to the ROM image
   143 if ($image_path) {
   141 if ($image_path) {
   144     $test_drop->{'test'}->{'plan'}->[0]->{'flash'}->[0];
   142 	my $set_params;
   145     my $flash_params = $test_drop->{'test'}->{'plan'}->[0]->{'flash'};
   143 	my $flash_params;
   146     $flash_params->[0] = { 'target-alias' => $test_target, 'images' => $image_path };
   144 	foreach $set_params (@{$test_drop->{'test'}->{'plan'}->[0]->{'session'}->[0]->{'set'}}) {
       
   145 		$test_target = $set_params->{'target'}->[0]->{'device'}->[0]->{'alias'};
       
   146 		$set_params->{'flash'}->[0];
       
   147 		$flash_params = $set_params->{'flash'};
       
   148 		$flash_params->[0] = { 'target-alias' => $test_target, 'images' => $image_path };
       
   149 	}
   147 }
   150 }
   148 
   151 
   149 # Insert the FileStoreAction parameter
   152 # Insert the FileStoreAction parameter
   150 my $postaction_params = $test_drop->{'test'}->{'postAction'}->[0]->{'params'}->{'param'}, if $publish;
   153 my $postaction_params = $test_drop->{'test'}->{'postAction'}->[0]->{'params'}->{'param'}, if $publish;
   151 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish;
   154 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish;