From: Arran Cudbard-Bell Date: Mon, 11 Mar 2019 10:00:31 +0000 (+0800) Subject: More test fixups X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ff8f723ecd9e8caae2eecb531ce8194eb75df42;p=thirdparty%2Ffreeradius-server.git More test fixups --- diff --git a/Makefile b/Makefile index 3ac16b540a5..44adf5fe735 100644 --- 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 diff --git a/src/tests/dict/all.mk b/src/tests/dict/all.mk index 840b1b2c3e3..ccda3af6618 100644 --- a/src/tests/dict/all.mk +++ b/src/tests/dict/all.mk @@ -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 diff --git a/src/tests/map/all.mk b/src/tests/map/all.mk index 38e47a32ee3..04b454bd7ce 100644 --- a/src/tests/map/all.mk +++ b/src/tests/map/all.mk @@ -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 diff --git a/src/tests/modules/test.mk b/src/tests/modules/test.mk index 817721eb460..67c41f4abbe 100644 --- a/src/tests/modules/test.mk +++ b/src/tests/modules/test.mk @@ -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; \ diff --git a/src/tests/unit/all.mk b/src/tests/unit/all.mk index c268298a9dc..2c53e024c2c 100644 --- a/src/tests/unit/all.mk +++ b/src/tests/unit/all.mk @@ -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