]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix CANONICAL_PATH when $(top_srcdir) has symlinks (#4611)
authorMax Khon <fjoe@samodelkin.net>
Mon, 25 Jul 2022 11:14:16 +0000 (14:14 +0300)
committerGitHub <noreply@github.com>
Mon, 25 Jul 2022 11:14:16 +0000 (07:14 -0400)
* Fix CANONICAL_PATH when $(top_srcdir) has symlinks:
in this case $(CURDIR) contains real path (with symlinks resolved)
and thus is not equal to $(top_srcdir)

This make most of changes in rev c2a6977a551acea0d927daa324e0353fa64ba221 not necessary

* Revert most of rev c2a6977a551acea0d927daa324e0353fa64ba221
(all changes related to $(CURDIR) != $(top_srcdir))

scripts/boiler.mk
src/tests/all.mk
src/tests/keywords/all.mk
src/tests/map/all.mk
src/tests/modules/all.mk
src/tests/radclient/all.mk

index 64cfd474cef7f50f108e2afc5d5b16f7e62e5210..b213fe5f471191e42b978bfa328ae4b1ccb75658 100644 (file)
@@ -317,7 +317,7 @@ endef
 #   top-level directory, the canonical form is the absolute path (i.e. from
 #   the root of the filesystem) also without "./" or "../" sequences.
 define CANONICAL_PATH
-$(patsubst ${CURDIR}/%,%,$(abspath ${1}))
+$(patsubst $(PWD)/%,%,$(patsubst ${CURDIR}/%,%,$(abspath ${1})))
 endef
 
 # COMPILE_C_CMDS - Commands for compiling C source code.
index 2ef71b426476c405a0e1c6eb23fa61d574ef79cc..daf96c0242bdacab136616d629b2ec47c1248ade 100644 (file)
@@ -116,7 +116,7 @@ define TEST_BOOTSTRAP
 #
 #  The test files are files without extensions.
 #
-OUTPUT.$(TEST) := $(patsubst %/,%,$(subst $(top_srcdir)/src,$(BUILD_DIR),$(abspath $(DIR))))
+OUTPUT.$(TEST) := $(patsubst %/,%,$(subst src/,$(BUILD_DIR)/,$(call CANONICAL_PATH,$(DIR))))
 OUTPUT := $$(OUTPUT.$(TEST))
 
 #
index 2293bc9bdf36f76b099c9f285d7b87a1a8b35f10..660b0b59039db53d79c7af85f2b508737a42fbc5 100644 (file)
@@ -59,7 +59,7 @@ $(OUTPUT)/depends.mk: $(addprefix $(DIR)/,$(sort $(FILES))) | $(OUTPUT)
                fi; \
                y=`grep 'PROTOCOL: ' $$x | sed 's/.*://;s/  / /g'`; \
                if [ "$$y" != "" ]; then \
-                       z=`echo $$x | sed 's,.*/,,;s/-/_/g'`; \
+                       z=`echo $$x | sed 's,src/tests/keywords/,,;s/-/_/g'`; \
                        echo "UNIT_TEST_KEYWORD_ARGS.$$z=-p $$y" >> $@; \
                        echo "" >> $@; \
                fi \
index abec5ec2250f8aa34dfad64f1e65ca7a7ddfc174..b7f06f69abb1b28e7cbd2af23bbec3cc7f512b20 100644 (file)
@@ -32,7 +32,7 @@ $(OUTPUT)/%: $(DIR)/% $(TEST_BIN_DIR)/unit_test_map
                        echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" \"$<\""; \
                        exit 1; \
                fi; \
-               FOUND=$$(grep -E '^(Error : )?.*/$(notdir $<)' $@.log | head -1 | sed 's/.*\[//;s/\].*//'); \
+               FOUND=$$(grep -E '^(Error : )?$<' $@.log | head -1 | sed 's/.*\[//;s/\].*//'); \
                EXPECTED=$$(grep -n ERROR $< | sed 's/:.*//'); \
                if [ "$$EXPECTED" != "$$FOUND" ]; then \
                        cat "$@.log"; \
index 084239ec5e2b762bb316c684ff2f06f66186b9c4..bd5ba01d5ec71770a197a1e20f722479f846a72f 100644 (file)
@@ -103,7 +103,7 @@ $(OUTPUT)/%: $(DIR)/%.unlang $(TEST_BIN_DIR)/unit_test_module | build.raddb
                        echo "MODULE_TEST_DIR=$(dir $<) MODULE_TEST_UNLANG=$< $(TEST_BIN)/unit_test_module -D share/dictionary -d src/tests/modules/ -i \"$@.attrs\" -f \"$@.attrs\" -r \"$@\" -xx"; \
                        exit 1; \
                fi; \
-               FOUND=$$(grep -E 'Error : .*/$(notdir $<)' $@.log | head -1 | sed 's/.*\[//;s/\].*//'); \
+               FOUND=$$(grep -E 'Error : $<' $@.log | head -1 | sed 's/.*\[//;s/\].*//'); \
                EXPECTED=$$(grep -n ERROR $< | sed 's/:.*//'); \
                if [ "$$EXPECTED" != "$$FOUND" ]; then \
                        cat "$@.log"; \
index 4dca87c517ea3c3e82a146e37c36b92454dde95e..75baac580c2376bd0c43f9a64498d3805d6fff93 100644 (file)
@@ -61,10 +61,6 @@ $(OUTPUT)/%: $(DIR)/% | $(TEST).radiusd_kill $(TEST).radiusd_start
        $(Q)if [ "$$(uname -s)" = "Darwin" ]; then sed -i .bak 's/via lo0/via lo/g' $(FOUND); fi
        $(Q)if [ "$$(uname -s)" = "FreeBSD" ]; then sed -i .bak 's/via (null)/via lo/g' $(FOUND); fi
 #
-#      Lets normalize pathnames
-#
-       $(Q)sed -i.bak 's,[^" ]*\(src/tests\),\1,' $(FOUND)
-#
 #      Remove all entries with "^_EXIT.*CALLED .*/"
 #      It is necessary to match all builds with/without -DNDEBUG
 #