# # Makefile.fpc for Free Pascal Tests directory # [install] fpcpackage=y [default] fpcdir=.. rule=allexectests [rules] # Subdirs available in the test subdir TESTSUBDIRS=cg cg/cdecl units/system units/dos units/crt units/objects # All full dirnames in the test/ dir including the subdir self TESTDIRS:=test $(addprefix test/,$(TESTSUBDIRS)) # Unix like OS ? ifeq ($(OS_TARGET),linux) INUNIX=1 endif ifeq ($(OS_TARGET),freebsd) INUNIX=1 endif # For linux by default no graph tests ifdef INUNIX NOGRAPH=1 endif # # Tools # ifndef FAILLIST export FAILLIST:=faillist endif ifndef LONGLOG export LONGLOG:=longlog endif ifndef LOG export LOG:=log endif units : units/$(FPCMADE) units/$(FPCMADE): $(MAKE) -C units DOTEST=./dotest$(EXEEXT) $(DOTEST) : units utils/dotest.pp utils/redir.pp utils/teststr.pp $(FPC) -Fuunits -FE. utils/dotest.pp DIGEST=./digest$(EXEEXT) $(DIGEST) : units utils/digest.pp utils/teststr.pp $(FPC) -Fuunits -FE. utils/digest.pp testcheck: units allpreps $(DOTEST) # # Dotest options # ifneq ($(FPC),ppc386$(EXEEXT)) override DOTESTOPT+=-c$(FPC) endif ifdef GRAPH override DOTESTOPT+=-g endif ifdef INTERACTIVE override DOTESTOPT+=-i endif # # Test run targets # DIRS=webtbs webtbf tbs tbf test test/cg test/units/system test/units/dos test/units/objects %.log : %.pp $(DOTEST) $(DOTESTOPT) $< %.elg : %.pp $(DOTEST) $(DOTESTOPT) -e $< # # Preparations for tests: # # 1. Copy target dependent ctest.o to test/cg # .PHONY: allpreps allpreps: allpreps-stamp.$(OS_TARGET) allpreps-stamp.$(OS_TARGET): $(FPC) -FE. -Fuunits test/cg/ptest.pp $(COPY) test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o test/cg $(COPY) test/units/system/test*.txt . $(ECHO) $(DATE) > allpreps-stamp.$(OS_TARGET) # # Compile tests # .PHONY: alltbs alltbf allwebtbs allwebtbf alltest alltests alltbs : testcheck $(patsubst %.pp,%.log,$(wildcard tbs/t*.pp)) alltbf : testcheck $(patsubst %.pp,%.log,$(wildcard tbf/t*.pp)) allwebtbs : testcheck $(patsubst %.pp,%.log,$(wildcard webtbs/t*.pp)) allwebtbf : testcheck $(patsubst %.pp,%.log,$(wildcard webtbf/t*.pp)) alltest : testcheck $(patsubst %.pp,%.log,$(wildcard $(addsuffix /t*.pp,$(TESTDIRS)))) alltests: alltest alltbs alltbf allwebtbs allwebtbf # # Compile and Run tests # .PHONY: allexectbs allexectbf allexecwebtbs allexecwebtbf allexectest allexectests allexectbs : testcheck $(patsubst %.pp,%.elg,$(wildcard tbs/t*.pp)) allexectbf : testcheck $(patsubst %.pp,%.elg,$(wildcard tbf/t*.pp)) allexecwebtbs : testcheck $(patsubst %.pp,%.elg,$(wildcard webtbs/t*.pp)) allexecwebtbf : testcheck $(patsubst %.pp,%.elg,$(wildcard webtbf/t*.pp)) allexectest : testcheck $(patsubst %.pp,%.elg,$(wildcard $(addsuffix /t*.pp,$(TESTDIRS)))) allexectests: allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf # # Clean # .PHONY: clean distclean clean: -rm -f $(addsuffix /*$(PPUEXT),$(DIRS)) -rm -f $(addsuffix /*$(OEXT),$(DIRS)) -rm -f $(addsuffix /*.rst,$(DIRS)) -rm -f $(addsuffix /*$(SHAREDLIBEXT),$(DIRS)) -rm -f $(addsuffix /*.log,$(DIRS)) -rm -f $(addsuffix /*.elg,$(DIRS)) ifdef INUNIX -rm -f $(wildcard $(patsubst %.pp,%$(EXEEXT),$(wildcard $(addsuffix /t*.pp,$(DIRS))))) else -rm -f $(addsuffix /*$(EXEEXT),$(DIRS)) endif -rm -f *.tmp core -rm -f $(LOG) $(LONGLOG) $(FAILLIST) -rm -f ppas.sh ppas.bat gmon.out allpreps-stamp.$(OS_TARGET) -rm -f test*.txt $(MAKE) -C units clean distclean: clean -rm -f dotest$(EXEEXT) dotest$(OEXT) redir$(PPUEXT) redir$(OEXT) -rm -f teststr$(PPUEXT) teststr$(OEXT) digest$(EXEEXT) digest$(OEXT) # # Main rules # .PHONY: all full rundigest dailytest rundigest : -$(DIGEST) all : allexectests full : clean allexectests rundigest info : @echo This Makefile allows to test the compiler @echo @echo Targets: @echo all - continue all tests @echo full - clean and run all tests @echo dailytest - run full and save results @echo in files having the date as extension @echo override DATESUFFIX:=$(shell $(DATE) +%Y.%m.%d) ifneq ($(wildcard log.$(DATESUFFIX)),) override DATESUFFIX=$(shell $(DATE) +%Y.%m.%d.%H.%M) endif ifneq ($(wildcard lastdate.txt),) LASTDATESUFFIX:=$(shell cat lastdate.txt) endif dailytest : full $(COPY) faillist faillist.$(DATESUFFIX) $(COPY) log log.$(DATESUFFIX) $(COPY) longlog longlog.$(DATESUFFIX) -$(DIGEST) > digest.$(DATESUFFIX) ifdef LASTDATESUFFIX -diff -u log.$(LASTDATESUFFIX) log.$(DATESUFFIX) > difflog.$(DATESUFFIX) -diff -u digest.$(LASTDATESUFFIX) digest.$(DATESUFFIX) > diffdigest.$(DATESUFFIX) -diff -u faillist.$(LASTDATESUFFIX) faillist.$(DATESUFFIX) > difflist.$(DATESUFFIX) endif @echo $(DATESUFFIX) > lastdate.txt