1# Automated testing to see if the output of Asymptote scripts changes when the 2# program is modified. 3 4# How to call asy from the tests/output/name.out directory 5ASY=../../../asy 6 7TESTS=$(basename $(wildcard *.asy)) 8 9# This command performs the testing on all scripts. 10diff: $(TESTS:=.diff) 11 12# This builds the reference copies of the output using a trusted version of asy 13ref: $(TESTS:=.ref) 14 15$(TESTS:=.ref) $(TESTS:=.out): %: 16 @echo Generating $@ 17 @rm -rf $@ 18 @mkdir $@ 19 @cd $@; \ 20 $(ASY) -keep ../$(basename $@) \ 21 >$(basename $@).stdout 2>$(basename $@).stderr; \ 22 ls >$(basename $@).ls; \ 23 rm -f *.dvi *.pdf *.gif *.jpg *.jpeg *.png 24 25# Ignore lines with timestamps of the form hh:mm, since the time changes between 26# runs. This regex is fairly broad and it may need to be narrowed. 27$(TESTS:=.diff): %.diff: %.out 28 diff -I "[0-9][0-9]:[0-9][0-9]" -u $(@:.diff=.ref) $(@:.diff=.out) 29 30clean: 31 rm -rf *.out 32 33# The reference copies should only be built at the start, or when the behaviour 34# of Asymptote is intentionally changed, so they are not usually removed by make 35# clean. 36veryclean: clean 37 rm -rf *.ref 38 39# This tells make to build every dependency from scratch, ignoring the dates on 40# files. 41.PHONY: $(TESTS:=.ref) $(TESTS:=.out) $(TESTS:=.diff) diff ref clean veryclean 42