common/tools/ats/ats_specialise_test_drop.pl
changeset 989 95924ae2e0d6
parent 836 675529c38614
child 991 f2c5bb4624be
child 993 4ae26accd7da
equal deleted inserted replaced
988:380b3f627065 989:95924ae2e0d6
    38 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.
    39 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.
    40 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.
    41 my $publish;	# Publishing folder for ats reports.
    41 my $publish;	# Publishing folder for ats reports.
    42 my $bld_drive;  # Subst'd drive
    42 my $bld_drive;  # Subst'd drive
       
    43 my $test_target; # The target which the tests will be run on
       
    44 my $image_path; # The path to the ROM image used for testing (not valid for WINSCW target)
    43 
    45 
    44 sub usage($);
    46 sub usage($);
    45 sub help();
    47 sub help();
    46 sub usage_error();
    48 sub usage_error();
    47 sub silent_command($);
    49 sub silent_command($);
    51 			    'build-id' => \$build_id,
    53 			    'build-id' => \$build_id,
    52 			    'src' => \$srcfile,
    54 			    'src' => \$srcfile,
    53 			    'dest' => \$destfile,
    55 			    'dest' => \$destfile,
    54                 'help' => \$help,
    56                 'help' => \$help,
    55                 'publish' => \$publish,
    57                 'publish' => \$publish,
    56 				'bld-drive' => \$bld_drive);
    58 				'bld-drive' => \$bld_drive,
       
    59                 'test-target' => \$test_target,
       
    60                 'image-path' => \$image_path);
    57 
    61 
    58 GetOptions(\%optmap,
    62 GetOptions(\%optmap,
    59           'test-drop-name=s',
    63           'test-drop-name=s',
    60           'host-name=s',
    64           'host-name=s',
    61           'build-id=s',
    65           'build-id=s',
    62           'src=s',
    66           'src=s',
    63           'dest=s',
    67           'dest=s',
    64           'help!',
    68           'help!',
    65           'publish=s', 
    69           'publish=s', 
    66 		  'bld-drive=s') 
    70 		  'bld-drive=s',
       
    71           'test-target=s',
       
    72           'image-path=s') 
    67           or usage_error();
    73           or usage_error();
    68 
    74 
    69 # Check if Tie::File module installed
    75 # Check if Tie::File module installed
    70 eval("use Tie::File");
    76 eval("use Tie::File");
    71 if ($@) { $publish = ''; $bld_drive = ''; };
    77 if ($@) { $publish = ''; $bld_drive = ''; };
   124     $xml_in = $srcfile;
   130     $xml_in = $srcfile;
   125 }
   131 }
   126 
   132 
   127 # Parse the input XML into hashref.
   133 # Parse the input XML into hashref.
   128 my $test_drop = XMLin("./$xml_in", keeproot => 1,
   134 my $test_drop = XMLin("./$xml_in", keeproot => 1,
   129     forcearray => [ 'name', 'id','owner','priority','buildid','postAction','type','target','device', 'property', 'command', 'param'],#
   135     forcearray => [ 'name', 'id','owner','priority','buildid','postAction','type','target','device', 'property', 'command', 'param','plan'],#
   130         keyattr => [] );
   136         keyattr => [] );
   131     
   137     
   132 # Insert the specified test drop name, if any.
   138 # Insert the specified test drop name, if any.
   133 $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;
   134 # Insert the specified build id, if any.
   140 # Insert the specified build id, if any.
   135 $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
       
   143 if $image_path {
       
   144     my $flash_params = $test_drop->{'test'}->{'plan'}->[0]->{'flash'};
       
   145     $flash_params->[1] = { 'target-alias' => $test_target, 'images' => $image_path };
       
   146     }
       
   147 
       
   148 
   136 # Insert the FileStoreAction parameter
   149 # Insert the FileStoreAction parameter
   137 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;
   138 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish;
   151 $postaction_params->[1] = { 'name' => "to-folder", 'value' => $publish }, if $publish;
   139 
   152 
   140 if ($host_name) { # Also insert specified host name
   153 if ($host_name and (lc($test_target) ne "winscw") { # Also insert specified host name if target is WINSCW
   141 	my $devices = $test_drop->{'test'}->{'target'}->[0]->{'device'};
   154 	my $devices = $test_drop->{'test'}->{'target'}->[0]->{'device'};
   142     
   155     
   143     foreach my $device (@{$devices}) {
   156     foreach my $device (@{$devices}) {
   144         my $device_properties = $device->{'property'};
   157         my $device_properties = $device->{'property'};
   145         my $num_properties = @{$device_properties};
   158         my $num_properties = @{$device_properties};