-.SUFFIXES: .xsd .py _driver.py .comm .xml
+.SUFFIXES: .xsd .py _driver.py _test_driver_0.comm _test_driver_1.comm _test_driver_0.xml _test_driver_1.xml _test_driver_0.py _test_driver_1.py .comm .xml
+#TODO :Généraliser le suffixes pour les test_$i
.PHONY: xsdAll driverAll
SHELL=bash
cata_files= \
cata_gromacs.py \
-cata_Vimmp.py
+cata_Vimmp.py \
+cata_CSAndCPS.py
+#cata_cps.py
xsd_files = $(cata_files:%.py=%.xsd)
driver_files= $(cata_files:%.py=%_driver.py)
$(PYXB) -m $(basename $@) -u $^ --write-for-customization
xmllint --path $(confdir) --schema XMLSchema11_local.xsd --noout $^
-#Les Tools ont besoins d'un chemin absolu
-.comm.xml:
- $(tooldir)/generateXML.py -c $(realpath $(<:%.comm=%.py)) $<
+#Les Tools eficas ont besoins d'un chemin absolu
+# old
+#.comm.xml:
+# $(tooldir)/generateXML.py -c $(realpath $(<:%.comm=%.py)) $<
+# new
+#_test_driver_0.comm_test_driver_0.xml:
+# $(tooldir)/generateXML.py -c $(realpath $(*).py) $<
+#ok:
+#define test_driver_rule =
+#_test_driver_$1.comm_test_driver_$1.xml:
+# $(tooldir)/generateXML.py -c $$(realpath $$(*).py) $$<
+#endef
+#ok mais a séparer en deux règles :
+#define test_driver_rule =
+#_test_driver_$1.comm_test_driver_$1.xml: $$(confdir)/test_driver_subst.py
+# @echo -e "\n\n------ Generate xml test file $$(@) ------\n"
+# $(tooldir)/generateXML.py -c $$(realpath $$(*).py) $$<
+# @echo -e "\n\n------ Generate xml test driver $$(@:%.xml=%.py) ------\n"
+# sed -e "s,@module@,$$(*)_driver,g" -e "s,@file@,$$(@),g" $$(confdir)/test_driver_subst.py > $$(<:%.comm=%.py) && \
+# chmod +x $$(<:%.comm=%.py);
+#endef
+
+define test_xml_rule =
+_test_driver_$1.comm_test_driver_$1.xml:
+ @echo -e "\n\n------ Generate xml test file $$(@) ------\n"
+ $(tooldir)/generateXML.py -c $$(realpath $$(*).py) $$<
+endef
+
+#ATTENTION : De mémoire la .sufix rule n'utilise pas les dépendances après le :
+# il faut les définir à part
+define test_driver_rule =
+_test_driver_$1.comm_test_driver_$1.py: $$(confdir)/test_driver_subst.py
+ @echo -e "\n\n------ Generate xml test driver $$(@) ------\n"
+ sed -e "s,@module@,$$(*)_driver,g" -e "s,@file@,$$(<:%.comm=%.xml),g" $$(confdir)/test_driver_subst.py > $$(@) && \
+ chmod +x $$(<:%.comm=%.py);
+endef
+
+#Définition des règles de construction pour les tests
+#$(eval $(call test_driver_rule,0))
+#$(eval $(call test_driver_rule,1))
+$(foreach it,0 1 2 3 4 5 6 7 8 9, $(eval $(call test_xml_rule,$(it))) )
+$(foreach it,0 1 2 3 4 5 6 7 8 9, $(eval $(call test_driver_rule,$(it))) )
+
+test_driver_xml:= $(patsubst %.comm,%.xml,$(wildcard *_test_driver_?.comm))
+test_driver_py:= $(patsubst %.comm,%.py,$(wildcard *_test_driver_?.comm))
# xml:
# @echo "Reminder: a .comm file is needed for this step"
################# REGLES DE TESTS ########################
+#OLD, UNUSED :
#Génération d'un .py de test par .xml de référence
-#TODO : Améliorer la génération pour ne pas regénérer inutilement les drivers, utilser plus les règles Makefiles...
+#TODO : Améliorer la génération pour ne pas regénérer inutilement les drivers, utiliser plus les règles Makefiles...
#TODO : Gestion ds un build séparé du srcdir
testGen: $(confdir)/test_driver_subst.py
for i in `ls *_test_driver_?.comm`; \
do \
+ echo -e "\n\n------ Generate test $${i/comm/py} ------\n" \
$(tooldir)/generateXML.py -c $$PWD/$${i/_test_driver_?.comm/.py} $${i} && \
sed -e "s,@module@,$${i/_test_driver_?.comm/}_driver,g" -e "s,@file@,$${i/.comm/.xml},g" $(confdir)/test_driver_subst.py > $${i/comm/py} && \
chmod +x $${i/comm/py};\
done
#Lancement de chaque test ds l'environement minimal
-testAll: testGen exec.sh driverAll
- for i in `ls *_test_driver*.py` ; do ./exec.sh python $$i ; done
+#testAll: testGen exec.sh driverAll
+# for i in `ls *_test_driver*.py` ; do echo -e "\n\n------ Launching $$i ------" && ./exec.sh python $$i || break ; done
+#
+testAll: exec.sh driverAll $(test_driver_xml) $(test_driver_py)
+ echo $(test_driver_xml)
+ echo $(test_driver_py)
+ for i in `ls *_test_driver*.py` ; do echo -e "\n\n------ Launching $$i ------" && ./exec.sh python $$i ; done
+# for i in `ls *_test_driver*.py` ; do echo -e "\n\n------ Launching $$i ------" && ./exec.sh python $$i || break ; done
#multiple target avec règle non possible.
#Ecrire une génération avec un define