]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More test fixups
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 11 Mar 2019 10:00:31 +0000 (18:00 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 11 Mar 2019 11:38:42 +0000 (19:38 +0800)
Makefile
src/tests/dict/all.mk
src/tests/map/all.mk
src/tests/modules/test.mk
src/tests/unit/all.mk

index 3ac16b540a5ea0e43e7c0b992c4066348bea6a69..44adf5fe73580f1e36c2951af1f7288617c352e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -76,10 +76,10 @@ $(BUILD_DIR)/tests/radiusd-c: raddb/test.conf ${BUILD_DIR}/bin/radiusd $(GENERAT
        @echo "ok"
        @touch $@
 
-test: ${BUILD_DIR}/bin/radiusd ${BUILD_DIR}/bin/radclient tests.bin tests.trie tests.unit tests.xlat tests.keywords tests.auth tests.modules $(BUILD_DIR)/tests/radiusd-c tests.eap | build.raddb
+test: ${BUILD_DIR}/bin/radiusd ${BUILD_DIR}/bin/radclient tests.bin tests.trie tests.unit test.xlat tests.keywords tests.auth tests.modules $(BUILD_DIR)/tests/radiusd-c tests.eap | build.raddb
        @$(MAKE) -C src/tests tests
 
-clean.test: clean.tests.keywords clean.tests.trie clean.tests.map clean.tests.xlat clean.tests.dict clean.tests.eap clean.tests.auth clean.tests.modules clean.tests.bin
+clean.test: clean.tests.keywords clean.tests.trie clean.tests.map clean.test.xlat clean.tests.dict clean.tests.eap clean.tests.auth clean.tests.modules clean.tests.bin
        @$(MAKE) -C src/tests clean
 
 #  Tests specifically for Travis. We do a LOT more than just
index 840b1b2c3e3a40703f1c1e6e4eccb2864a661335..ccda3af6618afdf33d0fe08e7f915ee7fc115f5c 100644 (file)
@@ -17,8 +17,9 @@ $(BUILD_DIR)/tests/dict/%: $(DIR)/% $(BUILD_DIR)/bin/unit_test_attribute $(TESTB
        ${Q}echo DICT UNIT-TEST $(notdir $@)
        ${Q}mkdir -p $@_dir
        ${Q}cp $< $@_dir/dictionary
-       ${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d "$@_dir" -r "$@" -xxx "$(dir $<)/empty.txt" || ! test -f "$@"; then \
+       ${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d "$@_dir" -r "$@" -xxx "$(dir $<)/empty.txt" > "$@.log" 2>&1 || ! test -f "$@"; then \
                echo "$(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d \"$@_dir\" -r \"$@\" \"$(dir $<)/empty.txt\""; \
+               cat "$@.log"; \
                exit 1; \
        fi
 
index 38e47a32ee3ff9ac35c3dde45ba9e384756dd57d..04b454bd7cef3ae2dcfa7ed39c23b18e7a348090 100644 (file)
@@ -19,26 +19,26 @@ $(MAP_OUTPUT): $(MAP_UNIT_BIN) | $(BUILD_DIR)/tests/map/
 #
 $(BUILD_DIR)/tests/map/%: $(top_srcdir)/src/tests/map/%
        ${Q}echo MAP_TEST $(notdir $<)
-       ${Q}if ! $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r "$@" $< > "$@.log" 2>&1 || ! test -f "$@"; then \
+       ${Q}if ! $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r "$@" "$<" > "$@.log" 2>&1 || ! test -f "$@"; then \
                if ! grep ERROR $< 2>&1 > /dev/null; then \
-                       cat $@; \
+                       cat "$@.log"; \
                        echo "# $@"; \
-                       echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" $<"; \
+                       echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" \"$<\""; \
                        exit 1; \
                fi; \
                FOUND=$$(grep $< $@ | head -1 | sed 's,^.*$(top_srcdir),,;s/:.*//;s/.*\[//;s/\].*//'); \
                EXPECTED=$$(grep -n ERROR $< | sed 's/:.*//'); \
                if [ "$$EXPECTED" != "$$FOUND" ]; then \
-                       cat $@; \
+                       cat "$@.log"; \
                        echo "# $@"; \
                        echo "E $$EXPECTED F $$FOUND"; \
-                       echo UNEXPECTED ERROR: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" $<"; \
+                       echo "UNEXPECTED ERROR: $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" \"$<\""; \
                        exit 1; \
                fi; \
        else \
-               if ! diff $<.log $@; then \
-                       echo FAILED: " diff $<.log $@"; \
-                       echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" $<"; \
+               if ! diff "$<.log" "$@.log"; then \
+                       echo "FAILED: diff \"$<.log\" \"$@.log\""; \
+                       echo "FAILED: $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary -r \"$@\" \"$<\""; \
                        exit 1; \
                fi; \
        fi
index 817721eb4603d75e26a859529e78542322406f2d..67c41f4abbe0eb37cb5dc747028e22bfeaee16df 100644 (file)
@@ -54,7 +54,7 @@ $(BUILD_DIR)/tests/modules/%: src/tests/modules/%.unlang $(BUILD_DIR)/tests/modu
        @echo MODULE-TEST $(lastword $(subst /, ,$(dir $@))) $(basename $(notdir $@))
        @if ! MODULE_TEST_DIR=$(dir $<) MODULE_TEST_UNLANG=$< $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/modules/ -i "$@.attrs" -f "$@.attrs" -r "$@" -xxx > "$@.log" 2>&1 || ! test -f "$@"; then \
                if ! grep ERROR $< 2>&1 > /dev/null; then \
-                       cat $@.log; \
+                       cat "$@.log"; \
                        echo "# $@.log"; \
                        echo "MODULE_TEST_DIR=$(dir $<) MODULE_TEST_UNLANG=$< $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/modules/ -i \"$@.attrs\" -f \"$@.attrs\" -r \"$@\" -xx"; \
                        exit 1; \
@@ -62,7 +62,7 @@ $(BUILD_DIR)/tests/modules/%: src/tests/modules/%.unlang $(BUILD_DIR)/tests/modu
                FOUND=$$(grep ^$< $@.log | head -1 | sed 's/:.*//;s/.*\[//;s/\].*//'); \
                EXPECTED=$$(grep -n ERROR $< | sed 's/:.*//'); \
                if [ "$$EXPECTED" != "$$FOUND" ]; then \
-                       cat $@.log; \
+                       cat "$@.log"; \
                        echo "# $@.log"; \
                        echo "MODULE_TEST_DIR=$(dir $<) MODULE_TEST_UNLANG=$< $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/modules/ -i \"$@.attrs\" -f \"$@.attrs\" -r \"$@\" -xx"; \
                        exit 1; \
index c268298a9dc921ac44a8a168dddd911f941bf6ed..2c53e024c2ce1672e10b802c0c04019a95613ab5 100644 (file)
@@ -48,11 +48,10 @@ $(BUILD_DIR)/tests/unit:
 #
 $(BUILD_DIR)/tests/unit/%: $(DIR)/% $(BUILD_DIR)/bin/unit_test_attribute $(TESTBINDIR)/unit_test_attribute | $(BUILD_DIR)/tests/unit
        ${Q}echo UNIT-TEST $(notdir $@)
-       ${Q}if ! $(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(top_srcdir)/src/tests/unit $<; then \
-               echo "$(TESTBIN)/unit_test_attribute -D $(top_srcdir)/share/dictionary -d $(top_srcdir)/src/tests/unit $<"; \
+       ${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 \"$@\" $<"; \
                exit 1; \
        fi
-       ${Q}touch $@
 
 #
 #  Get all of the unit test output files