]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use DIR for local directory
authorAlan T. DeKok <aland@freeradius.org>
Sun, 3 Nov 2019 14:43:54 +0000 (09:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 3 Nov 2019 14:43:54 +0000 (09:43 -0500)
we don't need TEST_FILES_DIR, because the boilermake framework
already sets DIR.

But we also need to re-set DIR as a rule-specific variable when
running the test.  Because eval of makefile and running of rule
are done at two different times

src/tests/unit/all.mk

index 82b7b43eb6b23f598c94db33fcb9e795511a6d98..ff49971bdd34fbdb0cd84c8f881cf6a48ace2cbd 100644 (file)
@@ -7,16 +7,11 @@
 #
 TEST := test.unit
 
-#
-#  Base directory for the test files
-#
-TEST_FILES_DIR := $(top_srcdir)/src/tests/unit
-
 #
 #  The files are put here in order.  Later tests need
 #  functionality from earlier test.
 #
-FILES  := $(subst $(TEST_FILES_DIR)/,,$(call FIND_FILES_SUFFIX,$(TEST_FILES_DIR),*.txt))
+FILES  := $(subst $(DIR)/,,$(call FIND_FILES_SUFFIX,$(DIR),*.txt))
 
 # dict.txt - removed because the unit tests don't allow for protocol namespaces
 
@@ -34,9 +29,10 @@ $(FILES.$(TEST)): export TZ = GMT
 #  And the actual script to run each test.
 #
 $(OUTPUT)/%: $(DIR)/% $(TESTBINDIR)/unit_test_attribute
-       ${Q}echo UNIT-TEST $(subst $(TEST_FILES_DIR)/,,$<)
-       ${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(top_srcdir)/src/tests/unit -r "$@" $<; then \
-               echo "$(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(top_srcdir)/src/tests/unit -r \"$@\" $<"; \
+       $(eval DIR:=${top_srcdir}/src/tests/unit)
+       ${Q}echo UNIT-TEST $(subst $(DIR)/,,$<)
+       ${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(DIR) -r "$@" $<; then \
+               echo "$(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(DIR) -r \"$@\" $<"; \
                rm -f $(BUILD_DIR)/tests/test.unit; \
                exit 1; \
        fi