From 406fe3f3cc51e1c91923c4f96aad024c196509e0 Mon Sep 17 00:00:00 2001 From: Bernard Davison Date: Wed, 21 Mar 2012 14:57:43 +1100 Subject: [PATCH] Cleaning up the reporting of example airframe compile test messages. Fixing the linux find command issue. Adding a check to see if the Ivy module will load and then skipping tests if it fails to load. --- tests/LisaL/01_With_b2_v1.2.t | 9 ++++--- tests/LisaL/02_With_aspirin_v1.5_and_overo.t | 9 ++++--- tests/Makefile | 4 +-- .../examples/01_compile_all_example_targets.t | 16 ++++++------ tests/sim/01_Microjet.t | 25 +++++++++++-------- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/tests/LisaL/01_With_b2_v1.2.t b/tests/LisaL/01_With_b2_v1.2.t index 23f83fdbcf..1226a524dc 100644 --- a/tests/LisaL/01_With_b2_v1.2.t +++ b/tests/LisaL/01_With_b2_v1.2.t @@ -1,10 +1,9 @@ #!/usr/bin/perl -w -use Test::More tests => 7; +use Test::More tests => 8; use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; use Program; use Proc::Background; -use Ivy; $|++; @@ -44,7 +43,11 @@ my $link = Proc::Background->new($link_command, @link_options); ok($link->alive(), "The link process started successfully"); # Open the Ivy bus and read from it... -# TODO: learn how to read and write to the Ivy bus +SKIP : { + skip "Skipping testing of the hardware since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} # Shutdown the server and link processes ok($server->die(), "The server process shutdown successfully."); diff --git a/tests/LisaL/02_With_aspirin_v1.5_and_overo.t b/tests/LisaL/02_With_aspirin_v1.5_and_overo.t index 32024c37e1..fbcb7875eb 100644 --- a/tests/LisaL/02_With_aspirin_v1.5_and_overo.t +++ b/tests/LisaL/02_With_aspirin_v1.5_and_overo.t @@ -1,10 +1,9 @@ #!/usr/bin/perl -w -use Test::More tests => 7; +use Test::More tests => 8; use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; use Program; use Proc::Background; -use Ivy; $|++; @@ -44,7 +43,11 @@ my $link = Proc::Background->new($link_command, @link_options); ok($link->alive(), "The link process started successfully"); # Open the Ivy bus and read from it... -# TODO: learn how to read and write to the Ivy bus +SKIP : { + skip "Skipping testing of the hardware since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} # Shutdown the server and link processes ok($server->die(), "The server process shutdown successfully."); diff --git a/tests/Makefile b/tests/Makefile index 4a3eba6134..ce5ba1e067 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,8 +3,8 @@ PERL = /usr/bin/perl TEST_VERBOSE = 0 NON_TEST_DIRS = lib|results HARDWARE_REGEX = Lisa|Tiny|Umarim -HARDWARE_TEST_DIRS = $(shell find -L $(PAPARAZZI_SRC)/tests -d 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -E "$(HARDWARE_REGEX)") -NON_HARDWARE_TEST_DIRS = $(shell find -L $(PAPARAZZI_SRC)/tests -d 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -Ev "$(HARDWARE_REGEX)") +HARDWARE_TEST_DIRS = $(shell find -L * -maxdepth 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -E "$(HARDWARE_REGEX)") +NON_HARDWARE_TEST_DIRS = $(shell find -L * -maxdepth 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -Ev "$(HARDWARE_REGEX)") ifneq ($(TARGET_BOARD),) TEST_DIRECTORIES = $(TARGET_BOARD) else diff --git a/tests/examples/01_compile_all_example_targets.t b/tests/examples/01_compile_all_example_targets.t index 275a370384..d16dc8c143 100644 --- a/tests/examples/01_compile_all_example_targets.t +++ b/tests/examples/01_compile_all_example_targets.t @@ -31,13 +31,13 @@ foreach my $example (sort keys%{$examples->{'aircraft'}}) next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1#i) and ($target =~ m#sim#i) ); #warn "EXAMPLE: [$example] TARGET: [$target]\n"; - my $make_upload_options = "AIRCRAFT=$example clean_ac $target.compile"; - my $upload_output = run_program( + my $make_options = "AIRCRAFT=$example clean_ac $target.compile"; + my $output = run_program( "Attempting to build the firmware $target for the airframe $example.", $ENV{'PAPARAZZI_SRC'}, - "make $make_upload_options", + "make $make_options", $ENV->{'TEST_VERBOSE'},1); - unlike($upload_output, '/\bError\b/i', "The upload output does not contain the word \"Error\""); + unlike($output, '/\bError\b/i', "The make output for the $example target $target does not contain the word \"Error\""); } } elsif ($process =~ m#target#) @@ -51,13 +51,13 @@ foreach my $example (sort keys%{$examples->{'aircraft'}}) next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1#i) and ($target =~ m#sim#i) ); #warn "EXAMPLET: [$example] TARGET: [$target]\n"; - my $make_upload_options = "AIRCRAFT=$example clean_ac $target.compile"; - my $upload_output = run_program( + my $make_options = "AIRCRAFT=$example clean_ac $target.compile"; + my $output = run_program( "Attempting to build the firmware $target for the airframe $example.", $ENV{'PAPARAZZI_SRC'}, - "make $make_upload_options", + "make $make_options", $ENV->{'TEST_VERBOSE'},1); - unlike($upload_output, '/\bError\b/i', "The upload output does not contain the word \"Error\""); + unlike($output, '/\bError\b/i', "The make output for the $example target $target does not contain the word \"Error\""); } } } diff --git a/tests/sim/01_Microjet.t b/tests/sim/01_Microjet.t index 6dfae3ec49..84959ebdba 100644 --- a/tests/sim/01_Microjet.t +++ b/tests/sim/01_Microjet.t @@ -1,16 +1,15 @@ #!/usr/bin/perl -w -use Test::More tests => 6; +use Test::More tests => 7; use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; use Program; use Proc::Background; -use Ivy; $|++; #################### # Make the airframe -my $make_compile_options = "AIRCRAFT=Microjet clean_ac sim.compile"; +my $make_compile_options = "AIRCRAFT=Microjet clean_ac sim"; my $compile_output = run_program( "Attempting to build the sim firmware.", $ENV{'PAPARAZZI_SRC'}, @@ -26,19 +25,23 @@ my $server = Proc::Background->new($server_command, @server_options); sleep 2; # The service should die in this time if there's an error ok($server->alive(), "The server process started successfully"); -# Start the sim process -my $link_command = "$ENV{'PAPARAZZI_HOME'}/sw/simulator/launchsitl"; -my @link_options = qw(-a -boot -norc); +# Start the launchsitl process +my $launchsitl_command = "$ENV{'PAPARAZZI_HOME'}/sw/simulator/launchsitl"; +my @launchsitl_options = qw(-a -boot -norc); sleep 2; # The service should die in this time if there's an error -my $link = Proc::Background->new($link_command, @link_options); -ok($link->alive(), "The launchsitl process started successfully"); +my $launchsitl = Proc::Background->new($launchsitl_command, @launchsitl_options); +ok($launchsitl->alive(), "The launchsitl process started successfully"); # Open the Ivy bus and read from it... -# TODO: learn how to read and write to the Ivy bus +SKIP : { + skip "Skipping testing of the simulator since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} -# Shutdown the server and link processes +# Shutdown the server and launchsitl processes ok($server->die(), "The server process shutdown successfully."); -ok($link->die(), "The launchsitl process shutdown successfully."); +ok($launchsitl->die(), "The launchsitl process shutdown successfully."); ################################################################################ # functions used by this test script.