Makefile.fpc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. #
  2. # Makefile.fpc for Free Pascal Tests directory
  3. #
  4. [install]
  5. fpcpackage=y
  6. [default]
  7. fpcdir=..
  8. rule=allexectests
  9. [require]
  10. packages_win32=mysql
  11. packages_linux=mysql
  12. [rules]
  13. # Subdirs available in the test subdir
  14. TESTSUBDIRS=cg cg/cdecl units/system units/dos units/crt units/objects
  15. # All full dirnames in the test/ dir including the subdir self
  16. TESTDIRS:=test $(addprefix test/,$(TESTSUBDIRS))
  17. # Unix like OS ?
  18. ifeq ($(OS_TARGET),linux)
  19. INUNIX=1
  20. endif
  21. ifeq ($(OS_TARGET),freebsd)
  22. INUNIX=1
  23. endif
  24. # For linux by default no graph tests
  25. ifdef INUNIX
  26. NOGRAPH=1
  27. endif
  28. #
  29. # Tools
  30. #
  31. ifndef FAILLIST
  32. export FAILLIST:=faillist
  33. endif
  34. ifndef LONGLOG
  35. export LONGLOG:=longlog
  36. endif
  37. ifndef LOG
  38. export LOG:=log
  39. endif
  40. ifndef CCOMPILER
  41. CCOMPILER:=$(strip $(wildcard $(addsuffix /gcc$(SRCEXEEXT),$(SEARCHPATH))))
  42. ifneq ($(CCOMPILER),)
  43. CCOMPILER:=$(firstword $(CCOMPILER))
  44. endif
  45. endif
  46. units : units/$(FPCMADE)
  47. units/$(FPCMADE):
  48. $(MAKE) -C units
  49. DOTEST=./dotest$(EXEEXT)
  50. $(DOTEST) : units utils/dotest.pp utils/redir.pp utils/teststr.pp
  51. $(FPC) -n -Fuunits -FE. utils/dotest.pp
  52. $(FPC) -n -Fuunits -FE. utils/fail.pp
  53. $(FPC) -n -Fuunits -FE. utils/testfail.pp
  54. ifneq ($(wildcard ./testfail$(SRCEXEEXT)),)
  55. TESTCOMSPECRES:=$(shell ./testfail$(SRCEXEEXT))
  56. endif
  57. ifneq ($(TESTCOMSPECRES),)
  58. NOCOMSPEC=1
  59. endif
  60. ifeq ($(USESQL),YES)
  61. DIGEST=./dbdigest$(EXEEXT)
  62. DBDIGEST=utils/dbtests.pp
  63. DIGESTSRC=utils/dbdigest.pp
  64. else
  65. DIGEST=./digest$(EXEEXT)
  66. DBDIGEST=
  67. DIGESTSRC=utils/digest.pp
  68. endif
  69. $(DIGEST) : units utils/digest.pp utils/teststr.pp utils/testu.pp $(DBDIGEST)
  70. $(FPC) -n -Fuunits -FE. $(DIGESTSRC)
  71. testcheck: units allpreps $(DOTEST)
  72. #
  73. # Dotest options
  74. #
  75. ifneq ($(FPC),ppc386$(EXEEXT))
  76. ifeq ($(findstring -c$(FPC),$(DOTESTOPT)),)
  77. override DOTESTOPT+=-c$(FPC)
  78. endif
  79. endif
  80. ifdef GRAPH
  81. override DOTESTOPT+=-g
  82. endif
  83. ifdef INTERACTIVE
  84. override DOTESTOPT+=-i
  85. endif
  86. ifdef DOALL
  87. override DOTESTOPT+=-a
  88. endif
  89. ifdef NOCOMSPEC
  90. override DOTESTOPT+=-x
  91. endif
  92. #
  93. # Test run targets
  94. #
  95. DIRS=webtbs webtbf tbs tbf test test/cg test/units/system test/units/dos test/units/objects
  96. %.log : %.pp $(DOTEST)
  97. $(DOTEST) $(DOTESTOPT) $<
  98. %.elg : %.pp $(DOTEST)
  99. $(DOTEST) $(DOTESTOPT) -e $<
  100. #
  101. # Preparations for tests:
  102. #
  103. # 1. Copy target dependent ctest.o to test/cg
  104. #
  105. .PHONY: allpreps
  106. ifdef CCOMPILER
  107. test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o : test/cg/obj/ctest.c
  108. -$(CCOMPILER) -c -o test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o test/cg/obj/ctest.c
  109. endif
  110. allpreps: allpreps-stamp.$(OS_TARGET)
  111. allpreps-stamp.$(OS_TARGET):
  112. $(FPC) -FE. -Fuunits test/cg/ptest.pp
  113. $(COPY) test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o test/cg
  114. $(COPY) test/units/system/test*.txt .
  115. $(ECHO) $(DATE) > allpreps-stamp.$(OS_TARGET)
  116. #
  117. # Compile tests
  118. #
  119. .PHONY: alltbs alltbf allwebtbs allwebtbf alltest alltests
  120. alltbs : testcheck $(patsubst %.pp,%.log,$(wildcard tbs/t*.pp))
  121. alltbf : testcheck $(patsubst %.pp,%.log,$(wildcard tbf/t*.pp))
  122. allwebtbs : testcheck $(patsubst %.pp,%.log,$(wildcard webtbs/t*.pp))
  123. allwebtbf : testcheck $(patsubst %.pp,%.log,$(wildcard webtbf/t*.pp))
  124. alltest : testcheck $(patsubst %.pp,%.log,$(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
  125. alltests: alltest alltbs alltbf allwebtbs allwebtbf
  126. #
  127. # Compile and Run tests
  128. #
  129. .PHONY: allexectbs allexectbf allexecwebtbs allexecwebtbf allexectest allexectests
  130. allexectbs : testcheck $(patsubst %.pp,%.elg,$(wildcard tbs/t*.pp))
  131. allexectbf : testcheck $(patsubst %.pp,%.elg,$(wildcard tbf/t*.pp))
  132. allexecwebtbs : testcheck $(patsubst %.pp,%.elg,$(wildcard webtbs/t*.pp))
  133. allexecwebtbf : testcheck $(patsubst %.pp,%.elg,$(wildcard webtbf/t*.pp))
  134. allexectest : testcheck $(patsubst %.pp,%.elg,$(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
  135. allexectests: allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf
  136. #
  137. # Clean
  138. #
  139. .PHONY: clean distclean
  140. clean:
  141. -rm -f $(addsuffix /*$(PPUEXT),$(DIRS))
  142. -rm -f $(addsuffix /*$(OEXT),$(DIRS))
  143. -rm -f $(addsuffix /*.rst,$(DIRS))
  144. -rm -f $(addsuffix /*$(SHAREDLIBEXT),$(DIRS))
  145. -rm -f $(addsuffix /*.log,$(DIRS))
  146. -rm -f $(addsuffix /*.elg,$(DIRS))
  147. ifdef INUNIX
  148. -rm -f $(wildcard $(patsubst %.pp,%$(EXEEXT),$(wildcard $(addsuffix /t*.pp,$(DIRS)))))
  149. else
  150. -rm -f $(addsuffix /*$(EXEEXT),$(DIRS))
  151. endif
  152. -rm -f test*.txt *.tmp *$(SHAREDLIBEXT) *$(OEXT) *$(PPUEXT) core
  153. -rm -f $(LOG) $(LONGLOG) $(FAILLIST)
  154. -rm -f ptest.* ppas.sh ppas.bat gmon.out allpreps-stamp.$(OS_TARGET)
  155. $(MAKE) -C units clean
  156. distclean: clean
  157. -rm -f dotest$(EXEEXT) digest$(EXEEXT)
  158. #
  159. # Main rules
  160. #
  161. .PHONY: all full rundigest dailytest onlyknown onlygraph onlyinteractive
  162. rundigest : $(DIGEST)
  163. -$(DIGEST)
  164. all : allexectests
  165. full : clean allexectests rundigest
  166. onlyknown :
  167. $(MAKE) full "DOTESTOPT= $(DOTESTOPT) -k-"
  168. onlygraph :
  169. $(MAKE) full "DOTESTOPT= $(DOTESTOPT) -g-"
  170. onlyinteractive :
  171. $(MAKE) "DOTESTOPT= $(DOTESTOPT) -i-"
  172. info :
  173. @echo This Makefile allows to test the compiler
  174. @echo
  175. @echo Targets:
  176. @echo " all - continue all tests"
  177. @echo " full - clean and run all tests"
  178. @echo " dailytest - run full and save results"
  179. @echo " in files having the date as extension"
  180. @echo " onlyknown - run only known bugs"
  181. @echo " onlygraph - run only graph tests"
  182. @echo " onlyinteractive - run only interactive tests"
  183. @echo Done using FPC=$(FPC)
  184. ifdef COMSPEC
  185. @echo And using COMSPEC=$(COMSPEC)
  186. endif
  187. override DATESUFFIX:=$(shell $(DATE) +%Y.%m.%d)
  188. ifneq ($(wildcard log.$(DATESUFFIX)),)
  189. override DATESUFFIX=$(shell $(DATE) +%Y.%m.%d.%H.%M)
  190. endif
  191. ifneq ($(wildcard lastdate.txt),)
  192. LASTDATESUFFIX:=$(shell cat lastdate.txt)
  193. endif
  194. dailytest : full
  195. $(COPY) faillist faillist.$(DATESUFFIX)
  196. $(COPY) log log.$(DATESUFFIX)
  197. $(COPY) longlog longlog.$(DATESUFFIX)
  198. -$(DIGEST) > digest.$(DATESUFFIX)
  199. ifdef LASTDATESUFFIX
  200. -diff -u log.$(LASTDATESUFFIX) log.$(DATESUFFIX) > difflog.$(DATESUFFIX)
  201. -diff -u digest.$(LASTDATESUFFIX) digest.$(DATESUFFIX) > diffdigest.$(DATESUFFIX)
  202. -diff -u faillist.$(LASTDATESUFFIX) faillist.$(DATESUFFIX) > difflist.$(DATESUFFIX)
  203. endif
  204. @echo $(DATESUFFIX) > lastdate.txt