1 MAP_TESTS := $(patsubst $(top_srcdir)/src/tests/map/%,%,$(filter-out %.conf %.md %.attrs %.c %.mk %~ %.rej %.out,$(wildcard $(top_srcdir)/src/tests/map/*)))
2 MAP_OUTPUT := $(addsuffix .out,$(addprefix $(BUILD_DIR)/tests/map/,$(MAP_TESTS)))
3 MAP_UNIT_BIN := $(BUILD_DIR)/bin/local/map_unit
4 MAP_UNIT := ./build/make/jlibtool --silent --mode=execute $(MAP_UNIT_BIN)
6 .PHONY: $(BUILD_DIR)/tests/map/
7 $(BUILD_DIR)/tests/map/:
11 # Re-run the tests if the test program changes
13 # Create the output directory before the files
15 $(MAP_OUTPUT): $(MAP_UNIT_BIN) | $(BUILD_DIR)/tests/map/
18 # Re-run the tests if the input file changes
20 $(BUILD_DIR)/tests/map/%.out: $(top_srcdir)/src/tests/map/%
21 @echo MAP_TEST $(notdir $<)
22 @if ! $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $< > $@ 2>&1; then \
23 if ! grep ERROR $< 2>&1 > /dev/null; then \
26 echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $<"; \
29 FOUND=$$(grep $< $@ | head -1 | sed 's,^.*$(top_srcdir),,;s/:.*//;s/.*\[//;s/\].*//'); \
30 EXPECTED=$$(grep -n ERROR $< | sed 's/:.*//'); \
31 if [ "$$EXPECTED" != "$$FOUND" ]; then \
34 echo "E $$EXPECTED F $$FOUND"; \
35 echo UNEXPECTED ERROR: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $<"; \
39 if ! diff $<.out $@; then \
40 echo FAILED: " diff $<.out $@"; \
41 echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $<"; \
46 TESTS.MAP_FILES := $(MAP_OUTPUT)
48 $(TESTS.MAP_FILES): $(TESTS.UNIT_FILES)
50 tests.map: $(MAP_OUTPUT)