From: Alan T. DeKok Date: Wed, 5 Apr 2023 02:11:42 +0000 (-0400) Subject: move copy of attrs file to make rules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01140f545c7f8a8b9463d05b71eb6695c6bb0a1e;p=thirdparty%2Ffreeradius-server.git move copy of attrs file to make rules so that we don't do the copy every time --- diff --git a/src/tests/keywords/all.mk b/src/tests/keywords/all.mk index c5a17fd825..59924f7243 100644 --- a/src/tests/keywords/all.mk +++ b/src/tests/keywords/all.mk @@ -39,6 +39,20 @@ test.keywords.${1}: $(addprefix $(OUTPUT)/,${1}) test.keywords.help: TEST_KEYWORDS_HELP += test.keywords.${1} +# +# Create the input attrs, either from the test-specific input, +# or from the default input. +# +$(OUTPUT)/${1}: $(OUTPUT)/${1}.attrs | $(dir $(OUTPUT)/${1}) +$(OUTPUT)/${1}.attrs: | $(dir $(OUTPUT)/${1}) + +ifneq "$(wildcard src/tests/keywords/${1}.attrs)" "" +$(OUTPUT)/${1}.attrs: src/tests/keywords/${1}.attrs +else +$(OUTPUT)/${1}.attrs: src/tests/keywords/default-input.attrs +endif + @cp $$< $$@ + # # All of the "update" tests which should also be run with "-S rewrite_update=yes" # @@ -135,7 +149,6 @@ KEYWORD_LIBS := $(addsuffix .la,$(addprefix rlm_,$(KEYWORD_MODULES))) rlm_csv.la $(OUTPUT)/%: $(DIR)/% $(TEST_BIN_DIR)/unit_test_module | $(KEYWORD_RADDB) $(KEYWORD_LIBS) build.raddb rlm_test.la rlm_csv.la rlm_unpack.la $(eval CMD:=KEYWORD=$(notdir $@) $(TEST_BIN)/unit_test_module $(NEW_COND) $(UNIT_TEST_KEYWORD_ARGS.$(subst -,_,$(notdir $@))) -D share/dictionary -d src/tests/keywords/ -i "$@.attrs" -f "$@.attrs" -r "$@" -xx) @echo "KEYWORD-TEST $(notdir $@)" - ${Q}cp $(if $(wildcard $<.attrs),$<.attrs,$(dir $<)/default-input.attrs) $@.attrs ${Q}if ! $(CMD) > "$@.log" 2>&1 || ! test -f "$@"; then \ if ! grep ERROR $< 2>&1 > /dev/null; then \ cat $@.log; \