diff --git a/Makefile b/Makefile index a509f520ef..1e476c208e 100644 --- a/Makefile +++ b/Makefile @@ -317,6 +317,11 @@ test: test_math test_examples test_examples: all CONF_XML=conf/conf_tests.xml prove tests/examples/ +test_all_confs: all + $(Q)$(eval $CONFS:=$(shell ./find_confs.py)) + @echo "Found $(words $($CONFS)) config files: $($CONFS)" + $(Q)$(foreach conf,$($CONFS),echo "Testing all aircrafts in conf: $(conf)" && CONF_XML=$(conf) prove tests/examples/ ;) + # run some math tests that don't need whole paparazzi to be built test_math: make -C tests/math @@ -331,4 +336,4 @@ test_sim: all subdirs $(SUBDIRS) conf ext libpprz multimon cockpit cockpit.opt tmtc tmtc.opt generators\ static sim_static lpctools commands \ clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible \ -test test_examples test_math test_sim +test test_examples test_math test_sim test_all_confs diff --git a/find_confs.py b/find_confs.py new file mode 100755 index 0000000000..28dd787a46 --- /dev/null +++ b/find_confs.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import os +from fnmatch import fnmatch + +def find_conf_files(pprz_home, conf_dir, exclude_backups=True): + conf_files = [] + pattern = "*conf[._-]*xml" + backup_pattern = "*conf[._-]*xml.20[0-9][0-9]-[01][0-9]-[0-3][0-9]_*" + excludes = ["%gconf.xml"] + + for path, subdirs, files in os.walk(conf_dir): + for name in files: + if exclude_backups and fnmatch(name, backup_pattern): + continue + if fnmatch(name, pattern): + filepath = os.path.join(path, name) + entry = os.path.relpath(filepath, pprz_home) + if not os.path.islink(filepath) and name not in excludes: + conf_files.append(entry) + return conf_files + +if __name__ == "__main__": + paparazzi_home = os.getenv("PAPARAZZI_HOME", os.path.dirname(os.path.abspath(__file__))) + # print("PAPARAZZI_HOME=" + paparazzi_home) + conf_dir = os.path.join(paparazzi_home, "conf") + # print("conf dir: " + conf_dir) + conf_files = find_conf_files(paparazzi_home, conf_dir) + print(" ".join(conf_files))