################################################ # test engine # where are the test outputs stored? Wants= $(shell cd $(Want); ls ) # Header, for top of each test run Hi= printf "\n---| $(u) |-----------------------------------------\n\n" # run one thing run : @$(Hi) @$(MAKE) u=$u $u # run one thing and cache the output cache : @$(MAKE) run | tee $(Want)/$u @echo new test result cached to $(Want)/$u # run one thing and compare output to the cache test : $(Want)/$u @$(MAKE) run | tee $(Tmp)/$u.got @if diff -s $(Tmp)/$u.got $(Want)/$u > /dev/null; \ then echo PASSED $u ; \ else echo FAILED $u, got $(Tmp)/$u.got; \ fi # run all examples, don't test the outputs egs : ready @$(foreach x,$(EGS), $(MAKE) u=$x run; ) # run all things with Want files, testing the output tests : ready @$(foreach x, $(Wants), $(MAKE) u=$x test;) # run all things with Want files, testing the output, counting pass/fails score : @$(MAKE) tests | cut -d\ -f 1 | egrep '(PASSED|FAILED)' | sort | uniq -c