diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:50:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:50:17 +0000 |
commit | 86ed03f8adee56c050c73018537371c230a664a6 (patch) | |
tree | eae3d04cdf1c49848e5a671327ab38297f4acb0d /make/agentpycheck.mk | |
parent | Initial commit. (diff) | |
download | fence-agents-86ed03f8adee56c050c73018537371c230a664a6.tar.xz fence-agents-86ed03f8adee56c050c73018537371c230a664a6.zip |
Adding upstream version 4.12.1.upstream/4.12.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | make/agentpycheck.mk | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/make/agentpycheck.mk b/make/agentpycheck.mk new file mode 100644 index 0000000..4044dba --- /dev/null +++ b/make/agentpycheck.mk @@ -0,0 +1,44 @@ +DATADIR:=$(abs_top_srcdir)/tests/data/metadata +AWK_VAL='BEGIN {store=-1} /name=".*_path"/ || /name=".*_file"/ {store=2} {if (store!=0) {print}; store--}' + +TEST_TARGET=$(filter-out $(TEST_TARGET_SKIP),$(TARGET)) + +check: $(TEST_TARGET:%=%.xml-check) $(SYMTARGET:%=%.xml-check) $(TEST_TARGET:%=%.delay-check) $(TEST_TARGET:%=%.rng-check) +delay-check: $(TEST_TARGET:%=%.delay-check) $(SYMTARGET:%=%.delay-check) +xml-check: $(TEST_TARGET:%=%.xml-check) $(SYMTARGET:%=%.xml-check) +xml-upload: $(TEST_TARGET:%=%.xml-upload) $(SYMTARGET:%=%.xml-upload) + +%.xml-check: %.8 + $(eval INPUT=$(subst .xml-check,,$(@F))) + for x in $(INPUT) `PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$(INPUT) -o metadata | grep symlink | sed -e "s/.*\(fence.*\)\" .*/\1/g"`; do \ + TEMPFILE=$$(mktemp); \ + PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$$x -o metadata | $(AWK) $(AWK_VAL) > $$TEMPFILE && \ + diff $$TEMPFILE $(DATADIR)/$$x.xml || exit 1 && \ + rm $$TEMPFILE; \ + done + +%.xml-upload: %.8 + $(eval INPUT=$(subst .xml-upload,,$(@F))) + for x in $(INPUT) `PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$(INPUT) -o metadata | grep symlink | sed -e "s/.*\(fence.*\)\" .*/\1/g"`; do \ + PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$$x -o metadata | $(AWK) $(AWK_VAL) > $(DATADIR)/$$x.xml; \ + done + +# If test will fail, rerun fence agents to show problems +%.delay-check: % + $(eval INPUT=$(subst .delay-check,,$(@F))) + for x in $(INPUT) `PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$(INPUT) -o metadata | grep symlink | sed -e "s/.*\(fence.*\)\" .*/\1/g"`; do \ + test `PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib /usr/bin/time -p \ + sh -c "printf 'delay=10\n $(FENCE_TEST_ARGS)' | $(PYTHON) $(@D)/$$x" 2>&1 |\ + awk -F"[. ]" -vOFS= '/real/ {print $$2,$$3}'` -ge 1000 || ( \ + PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib /usr/bin/time -p \ + sh -c "printf 'delay=0\n $(FENCE_TEST_ARGS)' | $(PYTHON) $(@D)/$$x"; false ); \ + done + +%.rng-check: % + $(eval INPUT=$(subst .rng-check,,$(@F))) + for x in $(INPUT) `PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$(INPUT) -o metadata | grep symlink | sed -e "s/.*\(fence.*\)\" .*/\1/g"`; do \ + PYTHONPATH=$(abs_top_srcdir)/lib:$(abs_top_builddir)/lib $(PYTHON) $(@D)/$$x -o metadata | \ + xsltproc ${abs_top_srcdir}/lib/fence2rng.xsl - | \ + sed -e 's/ rha:description=/ description=/g' -e 's/ rha:name=/ name=/g' | \ + xmllint --nsclean --noout -; \ + done |