#This is an ICE FU file # I = include files # C = config # E = examples # F = filters # U = utilities ##################################################################### # "U" : utilities (change these rarely) Root= .# this line must be the root directory of the install #include $(Root)/lib/make/unittest.mk Var= $(Root)/var# H= $(Root)/var/html# R= $(Root)/var/run# Etc= $(Root)/etc# Want= $(Root)/etc/want# Data= $(Root)/etc/data# Doc= $(Root)/doc# Tmp= $(HOME)/tmp# Src= $(Root)/lib# Dirs= $(Var) $R $H $(Etc) $(Want) $(Doc) $(Tmp) $(Src) #include $(Root)/lib/make/awk.mk Awk= $(Root)/lib/awk# remember to hand build this directory Awks= $(shell cd $(Awk); ls *.awk)# Spy= --dump-variables=$(Tmp)/clamvars.out --profile=$(Tmp)/clamprof.out # Gawk= $(shell which gawk) Run= $(Gawk) -f $R/tim.awk # Debug= $(MAKE) -B Run="$(shell which pgawk) -f $R/tim.awk $(Spy) " #include $(Root)/lib/make/unittest.mk ################################################ # 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" ##################################################################### # "C" : config (change these a lot) Bins=10# Best=8# Beam=200# Goal=1# EGS= eg1 eg2 eg3 eg4 # default example u= eg1# ##################################################################### # "F" : filters (change sometimes) #%.log : %.csv # $(Run) -f $R/log.awk $< > $@ %.sym : %.csv @$(Run) -f $R/discrete.awk Bins=$(Bins) Best=$(Best) Pass=1 $< Pass=2 $< > $@ @$(Run) -f $R/classes.awk $@ %.best : %.sym @$(Run) -f $R/br.awk Beam=$(Beam) Goal=$(Goal) $< > $@ $R/%.awk : $(Awk)/%.awk $(Gawk) -f $(Awk)/comment.awk $< > $@ ##################################################################### # "E" : examples (change these a lot) noop : @true eg1 : version eg1a: @$(Debug) $(Data)/auto.log eg2a : $(MAKE) Bins=10 Best=8 $(Data)/auto.sym eg2 : @$(Debug) Bins=10 Best=8 $(Data)/auto.sym vars eg3 : eg2 @for((I=1;I<=8;I++)) ; do \ echo ""; cut -d, -f $$I $(Data)/auto.sym | sort -n | uniq -c ; \ done eg4 : @$(Debug) Bins=10 Best=8 $(Data)/auto.best vars @cat $(Data)/auto.best | sed 's/=/ /g' | sort -k 4 -n -k 1 eg5 : @$(Debug) $(Data)/weatherNominal.best vars @cat $(Data)/weatherNominal.best | sed 's/=/ /g' | sort -k 4 eg6 : @$(Debug) $(Data)/weather.best vars @cat $(Data)/weather.best | sed 's/=/ /g' | sort -k 4 eg7: echo "25000 $$RANDOM" | gawk -f lib/awk/zhang.awk > etc/data/zhang.csv make Bins=10 Best=8 Beam=10 etc/data/zhang.sym cp etc/data/zhang.sym ~/tmp/sage make Bins=10 Best=8 Beam=10 etc/data/zhang.best gawk '/\[ 1/' etc/data/zhang.best | sed 's/=/ /g' | sort -n ##################################################################### # "U" : utilities (change sometimes) version : @cat doc/version.txt about : LICENSE USAGE @cat LICENSE; echo ""; cat USAGE ready : installDirs installFiles installFiles : $R/$(subst .awk ,.awk $R/,$(Awks)) @svn propset svn:ignore $(Data)/*.sym . > /dev/null @svn propset svn:ignore $(Data)/*.best . > /dev/null installDirs : @$(foreach d, $(Dirs), (if [ ! -d "$d" ]; then mkdir $d; fi);) @svn propset svn:ignore $(Tmp) . > /dev/null @svn propset svn:ignore $(Var) . > /dev/null clean : cd $(Data); rm -f *.sym *.best cd $R; rm *.awk vars : $(Tmp)/clamvars.out @- printf "\nVARS\n====\n" @- egrep -v '^[A-Z]*:' $< profile : $(Tmp)/clamprof.out @- printf "\nPROFILE\n========\n" @- cat $< # 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