From aa30d328d760034a08bb17daedbddfd92a334bc7 Mon Sep 17 00:00:00 2001 From: Patrick Baudin <patrick.baudin@cea.fr> Date: Fri, 17 Jun 2022 11:54:22 +0200 Subject: [PATCH] change 'xargs --null' -> 'xargs -0' --- share/Makefile.linting | 12 ++++++++---- share/Makefile.testing | 23 ++++++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/share/Makefile.linting b/share/Makefile.linting index b13d5892b2e..5d2d83119ac 100644 --- a/share/Makefile.linting +++ b/share/Makefile.linting @@ -52,17 +52,21 @@ TO_UTF8 ?= iconv -t UTF-8 -f OCP_INDENT ?= ocp-indent CLANG_FORMAT ?= clang-format +# wc, tail, head, cmp # Default values necessary for # LINT_MAKEFILE=<this-makefile> make -f <this-makefile> <lint-target>` # Otherwise theses variables are defined into share/Makefile.common SED ?= LC_ALL=C sed ISED ?= sed -i +FIND ?= find GIT ?= git MKDIR ?= mkdir -p MV ?= mv RM ?= rm -f +RMDIR ?= rm -rf TOUCH ?= touch +XARGS ?= xargs --no-run-if-empty ############ @@ -136,7 +140,7 @@ endif .PHONY: clean-lint clean-lint: echo "Cleaning LINT targets..." - rm -rf .lint + $(RMDIR) .lint clean:: clean-lint @@ -157,7 +161,7 @@ LINT.clean-targets+= \ # Generic rule $(LINT.clean-targets): echo "[LINT] Cleaning $(patsubst clean-%,%,$@) targets..." - find .lint -type f -name \*.$(patsubst clean-%,%,$@) | xargs -n 10 $(RM) + $(FIND) .lint -type f -name \*.$(patsubst clean-%,%,$@) | $(XARGS) -n 10 $(RM) ############################### @@ -180,7 +184,7 @@ $(LINT.check-targets): $(GIT) ls-files $(LINT.dir) -z \ | $(GIT) check-attr --stdin -z $@ \ | $(SED) -zne 'x;n;n;s/^set$$//;t print;b;:print;x;p' \ - | xargs --null -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' + | $(XARGS) -0 -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' #### fix-XXX targets @@ -195,7 +199,7 @@ $(LINT.fix-targets): $(GIT) ls-files $(LINT.dir) -z \ | $(GIT) check-attr --stdin -z $(patsubst fix-%,check-%,$@) \ | $(SED) -zne 'x;n;n;s/^set$$//;t print;b;:print;x;p' \ - | xargs --null -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' + | $(XARGS) -0 -IXX sh -c '$(LINT.make) LINT_FILE="XX" $@ || exit 255' else # LINT_FILE are given diff --git a/share/Makefile.testing b/share/Makefile.testing index 352d58e1b5e..7b9b0bca93f 100644 --- a/share/Makefile.testing +++ b/share/Makefile.testing @@ -24,11 +24,24 @@ # TESTING # ########### +################################ +## Default variables + # Defines where to find the ptest_config files PURGED_PTEST_DIRS?=tests $(wildcard src/plugins/*/tests) PTEST_OPTS?= PTEST_DIRS?=$(PURGED_PTEST_DIRS) +############ +# Default values necessary for make -f <this-makefile> + +XARGS ?= xargs --no-run-if-empty +GREP ?= grep +RM ?= rm -f +RMDIR ?= rm -rf + +########################################################################## + # Defines the related dune targets PTEST_ALIASES=$(addsuffix /ptests,$(addprefix @, tests src/plugins)) # TODO: uncomments when a dune file is at least generated for all PTEST_DIRS @@ -58,7 +71,7 @@ else # PTESTS is internal PTESTS=dune exec $(DUNE_BUILD_OPTS) --root ptests -- frama-c-ptests -#PTESTS=dune exec --root ptests -- frama-c-ptests -v +#PTESTS=dune exec $(DUNE_BUILD_OPTS) --root ptests -- frama-c-ptests -v # Note: the public name of ptest.exe is frama-c-ptests $(FRAMAC_PTESTS): ptests/ptests.ml @@ -96,18 +109,18 @@ wtests-help: $(WTESTS) --help ########################################################################## -## Removes all dune files generated for testing: xargs -n 10 avoids a too long line +## Removes all dune files generated for testing .PHONY: purge-tests purge-tests: find $(PURGED_PTEST_DIRS) -name dune \ - | grep -e "/oracle.*/dune\|/result.*/dune" \ - | xargs --no-run-if-empty -n 10 rm + | $(GREP) -e "/oracle.*/dune\|/result.*/dune" \ + | $(XARGS) -n 10 $(RM) # Force the full cleaning of the testing environment .PHONY: clean-tests clean-tests: purge-tests - rm -rf $(addprefix _build/default/,$(PURGED_PTEST_DIRS)) + $(RMDIR) $(addprefix _build/default/,$(PURGED_PTEST_DIRS)) ########################################################################## ## Generates all dune files used for testing -- GitLab