add a Makefile rule for refreshing test expected results

This commit is contained in:
Jesse D. McDonald 2020-10-24 10:48:38 -05:00
parent 688fe7369e
commit d68804f866
1 changed files with 11 additions and 2 deletions

View File

@ -1,11 +1,12 @@
SHELL = /bin/bash SHELL = /bin/bash
TARGET = jumpforth TARGET = jumpforth
SOURCES = $(TARGET).S SOURCES = $(TARGET).S
EXTRA_DEPS = startup.4th
all: $(TARGET) all: $(TARGET)
$(TARGET): $(SOURCES) startup.4th $(TARGET): $(SOURCES) $(EXTRA_DEPS)
gcc -m32 -nostdlib -static -o $@ $< gcc -m32 -nostdlib -static -o $@ $(filter-out $(EXTRA_DEPS),$^)
clean: test-clean clean: test-clean
$(RM) $(TARGET) $(RM) $(TARGET)
@ -18,6 +19,14 @@ test: $(TEST_RESULTS)
test-clean: test-clean:
$(RM) $(TEST_RESULTS) $(RM) $(TEST_RESULTS)
test-refresh: $(TEST_RESULTS)
@for act in $^; do \
exp="$${act%.act}.exp"; \
if ! diff -q "$$exp" "$$act" >/dev/null; then \
echo "Refreshing $$exp"; cp -- "$$act" "$$exp"; \
fi; \
done
.PHONY: $(TEST_RESULTS) .PHONY: $(TEST_RESULTS)
$(TEST_RESULTS): %.act: %.4th $(TARGET) $(TEST_RESULTS): %.act: %.4th $(TARGET)
@printf '%s … ' $(notdir $<) && \ @printf '%s … ' $(notdir $<) && \