From 81f562dc38070fb23923d5016dc1be2cebd836ee Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Thu, 12 Mar 2015 17:10:05 +0100 Subject: [PATCH] [build] possibilty to specify conf.xml file used for tests If the CONF_XML environment variable is set, use that conf.xml file instead of the standard $PAPARAZZI_HOME/conf/conf.xml Meaning you can run tests for a different conf without changing the conf.xml symlink, e.g. ``` CONF_XML=$PAPARAZZI_HOME/conf/conf_tests.xml prove tests/examples ``` --- Makefile.ac | 4 ++-- tests/examples/01_compile_all_aircrafts.t | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile.ac b/Makefile.ac index 1cf6306c38..449111ad03 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -28,7 +28,7 @@ include conf/Makefile.local # main directory where the generated files and compilation results for an aircraft are stored AIRCRAFT_BUILD_DIR = $(PAPARAZZI_HOME)/var/aircrafts/$(AIRCRAFT) CONF=$(PAPARAZZI_HOME)/conf -CONF_XML=$(CONF)/conf.xml +CONF_XML ?= $(CONF)/conf.xml AIRBORNE=sw/airborne MESSAGES_XML = $(CONF)/messages.xml @@ -231,7 +231,7 @@ $(SETTINGS_TELEMETRY) : $(PERIODIC_H) @echo "#######################################" @echo "# BUILD AIRCRAFT=$(AIRCRAFT), TARGET $*" @echo "#######################################" - $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) TARGET=$* Q=$(Q) $(GENERATORS)/gen_aircraft.out $(AIRCRAFT) + $(Q)PAPARAZZI_SRC=$(PAPARAZZI_SRC) PAPARAZZI_HOME=$(PAPARAZZI_HOME) TARGET=$* Q=$(Q) $(GENERATORS)/gen_aircraft.out $(AIRCRAFT) $(CONF_XML) %.compile: %.ac_h | print_version cd $(AIRBORNE); $(MAKE) -j$(NPROCS) TARGET=$* all diff --git a/tests/examples/01_compile_all_aircrafts.t b/tests/examples/01_compile_all_aircrafts.t index 3a0fb5764c..d597c7d154 100644 --- a/tests/examples/01_compile_all_aircrafts.t +++ b/tests/examples/01_compile_all_aircrafts.t @@ -35,7 +35,11 @@ use Cwd; $|++; my $xmlSimple = XML::Simple->new(ForceArray => 1); -my $conf = $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/conf.xml"); +my $conf_xml_file = $ENV{'CONF_XML'}; +if ($conf_xml_file eq "") { + $conf_xml_file = "$ENV{'PAPARAZZI_HOME'}/conf/conf.xml"; +} +my $conf = $xmlSimple->XMLin($conf_xml_file); sub get_num_targets @@ -57,7 +61,7 @@ sub get_num_targets } plan tests => get_num_targets()+1; -ok(1, "Parsed the configuration file"); +ok(1, "Parsed the $conf_xml_file configuration file"); foreach my $aircraft (sort keys%{$conf->{'aircraft'}}) { my $airframe = $conf->{'aircraft'}->{$aircraft}->{'airframe'};