Skip to content

Commit

Permalink
[tests] improve 01_compile_all_aircrafts.t
Browse files Browse the repository at this point in the history
- only fold arrays on 'name' for aircraft, firmware and target to not get warnings about none unique 'name' attribs for modules and subsytems
- if airframe file could not be parsed, show error at the end
  • Loading branch information
flixr committed Dec 19, 2015
1 parent 1f23c3f commit 8b6e82b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/aircrafts/01_compile_all_aircrafts.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ use IPC::Run qw( run );
use Cwd;

$|++;
my $xmlSimple = XML::Simple->new(ForceArray => 1);
# make sure that all elements are arrays and only fold arrays on name for aircraft, firmware and target
my $xmlSimple = XML::Simple->new(ForceArray => 1, KeyAttr => {aircraft => 'name', firmware => 'name', target => 'name'});
my $conf_xml_file = $ENV{'CONF_XML'};
if ($conf_xml_file eq "") {
$conf_xml_file = "$ENV{'PAPARAZZI_HOME'}/conf/conf.xml";
Expand All @@ -52,7 +53,7 @@ sub get_num_targets
{
my $airframe = $conf->{'aircraft'}->{$aircraft}->{'airframe'};
my $airframe_config = eval { $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/$airframe") };
warn $@ if ($@);
warn "Parsing airframe $airframe: $@" if ($@);
foreach my $process (sort keys %{$airframe_config->{'firmware'}})
{
foreach my $target (sort keys %{$airframe_config->{'firmware'}->{$process}->{'target'}})
Expand All @@ -76,7 +77,7 @@ foreach my $aircraft (sort keys%{$conf->{'aircraft'}})
if ($@)
{
warn "Skipping aircraft $aircraft: $@";
push @invalid_airframes, $airframe;
push @invalid_airframes, "$airframe: $@";
}
foreach my $process (sort keys %{$airframe_config->{'firmware'}})
{
Expand Down

0 comments on commit 8b6e82b

Please sign in to comment.