[test] update compile_all_aircrafts test

Also replace LOCAL_CFLAGS (which wasn't used anymore) with USER_CFLAGS (and add where missing).
Now you can e.g. test compile all aircrafts/targets in your conf and add extra flags like treating warnings as errors:

$ J=AUTO USER_CFLAGS=-Werror prove conf/examples
This commit is contained in:
Felix Ruess
2014-11-07 14:04:35 +01:00
parent 7b892a5ae0
commit 8df5ffbadc
10 changed files with 44 additions and 20 deletions
+1 -1
View File
@@ -283,7 +283,7 @@ DLIBS = -lm -lopencm3_stm32f4
#
# List all user C define here, like -D_DEBUG=1
UDEFS = $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -DUSE_OCM3_SYSTICK_INIT=0
UDEFS = $($(TARGET).CFLAGS) $(USER_CFLAGS) -DUSE_OCM3_SYSTICK_INIT=0
# Define ASM defines here
UADEFS =
+1 -1
View File
@@ -46,7 +46,7 @@ CFLAGS += -mtune=geode # optimize for geode
CFLAGS + = -Wstrict-prototypes -Wmissing-declarations
CFLAGS += -Wmissing-prototypes -Wnested-externs
CFLAGS += $(CSTANDARD)
CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS)
CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS)
#Additional libraries.
MATH_LIB = -lm
+1 -1
View File
@@ -38,7 +38,7 @@ Q=@
# Compilation flags
#
CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -O$(OPT)
CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(USER_CFLAGS) -O$(OPT)
LDFLAGS = -lm $($(TARGET).LDFLAGS)
+1 -1
View File
@@ -96,7 +96,7 @@ CFLAGS += -Wshadow
CFLAGS += -Wnested-externs
CFLAGS += $(CSTANDARD)
CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS)
CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS)
# Assembler flags.
ASFLAGS = -Wa,-adhlns=$(OBJDIR)/$(notdir $(<:.S=.lst))
+2 -2
View File
@@ -35,7 +35,7 @@ Q=@
CFLAGS = -W -Wall
CFLAGS += $(INCLUDES)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(LOCAL_CFLAGS)
CFLAGS += $(USER_CFLAGS)
CFLAGS += -O$(OPT)
CFLAGS += -g
CFLAGS += -std=gnu99
@@ -44,7 +44,7 @@ CFLAGS += $(shell pkg-config --cflags-only-I ivy-glib)
CXXFLAGS = -W -Wall
CXXFLAGS += $(INCLUDES)
CXXFLAGS += $($(TARGET).CFLAGS)
CXXFLAGS += $(LOCAL_CFLAGS)
CXXFLAGS += $(USER_CFLAGS)
CXXFLAGS += -O$(OPT)
CXXFLAGS += -g
CXXFLAGS += $(shell pkg-config --cflags-only-I ivy-glib)
+2
View File
@@ -54,6 +54,7 @@ CFLAGS += -Wstrict-prototypes -Wmissing-declarations
CFLAGS += -Wmissing-prototypes -Wnested-externs
CFLAGS += $(CSTANDARD)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(USER_CFLAGS)
LDFLAGS += -lm
@@ -62,6 +63,7 @@ CXXFLAGS += -g -ffunction-sections -fdata-sections
CXXFLAGS += -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp -march=armv7-a
CXXFLAGS += -Wall -Wextra
CXXFLAGS += $($(TARGET).CXXFLAGS)
CXXFLAGS += $(USER_CFLAGS)
SRC_C_OMAP = $($(TARGET).srcs)
OBJ_C_OMAP = $(SRC_C_OMAP:%.c=$(OBJDIR)/%.o)
+1 -1
View File
@@ -55,7 +55,7 @@ CFLAGS += -m32
CFLAGS += -Wstrict-prototypes -Wmissing-declarations
CFLAGS += -Wmissing-prototypes -Wnested-externs
CFLAGS += $(CSTANDARD)
CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS)
CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS)
#Additional libraries.
MATH_LIB = -lm
+1 -1
View File
@@ -51,7 +51,7 @@ INCLUDES += -I $(shell $(OCAMLC) -where)
CFLAGS = -W -Wall
CFLAGS += $(INCLUDES)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(LOCAL_CFLAGS)
CFLAGS += $(USER_CFLAGS)
CFLAGS += -fPIC
CFLAGS += -O$(OPT)
CFLAGS += -g
+2
View File
@@ -102,6 +102,8 @@ CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -Wshadow
CFLAGS += -Wnested-externs
CFLAGS += $(USER_CFLAGS)
#CFLAGS += -fno-diagnostics-show-caret
ifneq ($(ARCH_L), )
@@ -1,5 +1,24 @@
#!/usr/bin/perl -w
#
# Reads conf/conf.xml (can be symlink to e.g. conf/conf_tests.xml)
# and compiles all targets of all aircrafts.
#
# Mandatory environment variables:
# PAPARAZZI_SRC : path to paparazzi source directory
# PAPARAZZI_HOME : path to paparazz home directory containing the conf
#
# optional environment variables:
# TEST_VERBOSE : set to 1 to print the compile output even if there was no error
#
# environment variables passed on to make:
# J=AUTO : detect number of CPUs to set jobs for parallel compilation
#
# Example on how to test compile all aircrafts/targets in your current conf.xml
# with parallel compilation and treating all warnings as errors:
# J=AUTO USER_CFLAGS=-Werror prove tests/examples
#
use Test::More;
use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib";
use XML::Simple;
@@ -9,28 +28,28 @@ use Config;
$|++;
my $xmlSimple = XML::Simple->new(ForceArray => 1);
my $examples = $xmlSimple->XMLin("$ENV{'PAPARAZZI_SRC'}/conf/conf.xml");
my $conf = $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/conf.xml");
ok(1, "Parsed the tests configuration file");
foreach my $example (sort keys%{$examples->{'aircraft'}})
ok(1, "Parsed the configuration file");
foreach my $aircraft (sort keys%{$conf->{'aircraft'}})
{
my $airframe = $examples->{'aircraft'}->{$example}->{'airframe'};
my $airframe_config = $xmlSimple->XMLin("$ENV{'PAPARAZZI_SRC'}/conf/$airframe");
my $airframe = $conf->{'aircraft'}->{$aircraft}->{'airframe'};
my $airframe_config = $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/$airframe");
foreach my $process (sort keys %{$airframe_config->{'firmware'}})
{
#warn "EX: [$example] ". Dumper($airframe_config->{'firmware'}->{$process}->{'target'});
#warn "EX: [$aircraft] ". Dumper($airframe_config->{'firmware'}->{$process}->{'target'});
foreach my $target (sort keys %{$airframe_config->{'firmware'}->{$process}->{'target'}})
{
#warn "EXAMPLE: [$example] TARGET: [$target]\n";
my $make_options = "AIRCRAFT=$example clean_ac $target.compile";
#warn "AIRCRAFT: [$aircraft] TARGET: [$target]\n";
my $make_options = "AIRCRAFT=$aircraft clean_ac $target.compile";
my ($exit_status, $output) = run_program(
"Attempting to build the firmware $target for the aircraft $example.",
"Attempting to build the firmware $target for the aircraft $aircraft.",
$ENV{'PAPARAZZI_SRC'},
"make $make_options",
$ENV{'TEST_VERBOSE'},1);
# print output if it failed and we didn't already print it in verbose mode
warn "$output\n" if $exit_status && !$ENV{'TEST_VERBOSE'};
ok($exit_status == 0, "Compile aircraft: $example, target: $target");
ok($exit_status == 0, "Compile aircraft: $aircraft, target: $target");
}
}
}
@@ -68,13 +87,14 @@ sub run_program
my $exit_status = $?/256;
unless ($exit_status == 0)
{
my $err_msg = "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n";
if ($dont_fail_on_error)
{
warn "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n";
warn $err_msg;
}
else
{
die "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n";
die $err_msg;
}
}
my $output_string = join "\n", @output;