Makefile.fpc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. #
  2. # Makefile.fpc for Free Pascal Tests directory
  3. #
  4. [install]
  5. fpcpackage=y
  6. [default]
  7. fpcdir=..
  8. rule=allexectests
  9. [target]
  10. programs=gparmake
  11. [rules]
  12. unexport FPC_VERSION
  13. ################################
  14. # Test environment setup
  15. #
  16. TEST_HOSTNAME:=$(firstword $(subst ., ,$(shell hostname)))
  17. override TEST_FPC:=$(subst \,/,$(TEST_FPC))
  18. ifndef TEST_FPC
  19. #Use development version of the compiler
  20. TEST_FPC=$(wildcard $(dir $(CURDIR))compiler/$(notdir $(FPC)))
  21. ifeq ($(TEST_FPC), )
  22. $(error "*** ERROR: TEST_FPC is missing ***")
  23. endif
  24. endif
  25. #Defaults *not* to OPT
  26. ifndef TEST_OPT
  27. TEST_OPT=
  28. endif
  29. # disable directory cache; completely loading all directories significantly
  30. # slows down running the testsuite because the programs use very few units
  31. # and most testsuite directories contain thousands of files
  32. override TEST_OPT+=-Fd
  33. # Retrieve Test compiler info
  34. ifndef TEST_FPC_VERSION
  35. TEST_FPC_COMPILERINFO:=$(shell $(TEST_FPC) -iVSPTPSOTODW)
  36. TEST_FPC_VERSION:=$(word 1,$(TEST_FPC_COMPILERINFO))
  37. endif
  38. export TEST_FPC TEST_FPC_VERSION TEST_FPC_COMPILERINFO
  39. ifneq ($(words $(TEST_FPC_COMPILERINFO)),7)
  40. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iSP)
  41. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iTP)
  42. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iSO)
  43. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iTO)
  44. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iD)
  45. TEST_FPC_COMPILERINFO+=$(shell $(TEST_FPC) -iW)
  46. endif
  47. ifndef TEST_CPU_SOURCE
  48. TEST_CPU_SOURCE:=$(word 2,$(TEST_FPC_COMPILERINFO))
  49. endif
  50. ifndef TEST_CPU_TARGET
  51. TEST_CPU_TARGET:=$(word 3,$(TEST_FPC_COMPILERINFO))
  52. endif
  53. ifndef TEST_OS_SOURCE
  54. TEST_OS_SOURCE:=$(word 4,$(TEST_FPC_COMPILERINFO))
  55. endif
  56. ifndef TEST_OS_TARGET
  57. TEST_OS_TARGET:=$(word 5,$(TEST_FPC_COMPILERINFO))
  58. endif
  59. ifndef TEST_FPC_DATE
  60. TEST_FPC_DATE:=$(word 6,$(TEST_FPC_COMPILERINFO))
  61. endif
  62. ifndef TEST_FPC_FULLVERSION
  63. TEST_FPC_FULLVERSION:=$(word 7,$(TEST_FPC_COMPILERINFO))
  64. endif
  65. TEST_FULL_TARGET=$(TEST_CPU_TARGET)-$(TEST_OS_TARGET)
  66. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  67. TEST_TARGETSUFFIX=$(TEST_OS_TARGET)
  68. else
  69. ifneq ($(findstring $(TEST_OS_TARGET),$(LIMIT83fs)),)
  70. TEST_TARGETSUFFIX=$(TEST_OS_TARGET)
  71. else
  72. TEST_TARGETSUFFIX=$(TEST_FULL_TARGET)
  73. endif
  74. endif
  75. ifndef TEST_CCOMPILER
  76. ifeq ($(CPU_TARGET),$(TEST_CPU_TARGET))
  77. ifeq ($(OS_TARGET),$(TEST_OS_TARGET))
  78. TEST_CCOMPILER:=$(strip $(wildcard $(addsuffix /gcc$(SRCEXEEXT),$(SEARCHPATH))))
  79. ifneq ($(TEST_CCOMPILER),)
  80. TEST_CCOMPILER:=$(firstword $(TEST_CCOMPILER))
  81. endif
  82. endif
  83. endif
  84. endif
  85. # always enable smartlinking for msdos
  86. ifeq ($(TEST_OS_TARGET),msdos)
  87. override TEST_OPT+=-XX
  88. endif
  89. # Target dir where the ppu and binaries are created
  90. TEST_OUTPUTDIR=output/$(TEST_TARGETSUFFIX)
  91. C_SUBDIR=$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)
  92. # Date and time the testsuite was run
  93. ifneq ($(DATE),__missing_command_DATE)
  94. TEST_DATETIME:=$(shell $(DATE) +%Y%m%d%H%M)
  95. else
  96. # Use a spaceless string, as it will be used for file names
  97. TEST_DATETIME="No-date"
  98. endif
  99. ifndef TEST_USER
  100. TEST_USER=$(USER)
  101. ifeq ($(TEST_USER),)
  102. TEST_USER=$(USERNAME)
  103. endif
  104. endif
  105. # Testsuite upload
  106. DB_TARGZ=$(TEST_HOSTNAME)-$(TEST_DATETIME).tar.gz
  107. [email protected]
  108. DB_UPLOADDIR=/home/fpc/testsuite/incoming
  109. ifdef inWinNT
  110. inWinDOS=1
  111. endif
  112. ifeq ($(OS_SOURCE),go32v2)
  113. inWinDOS=1
  114. inDOS=1
  115. SINGLEDOTESTRUNS=1
  116. endif
  117. ################################
  118. # Misc
  119. #
  120. ifndef FAILLIST
  121. export FAILLIST:=$(TEST_OUTPUTDIR)/faillist
  122. endif
  123. ifndef LONGLOG
  124. export LONGLOG:=$(TEST_OUTPUTDIR)/longlog
  125. endif
  126. ifndef LOG
  127. export LOG:=$(TEST_OUTPUTDIR)/log
  128. endif
  129. # locations of all logfiles
  130. LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faillist
  131. LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog
  132. # Subdirs available in the test subdir
  133. TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt units/system units/dos units/crt units/objects units/strings units/sysutils units/math units/sharemem units/strutils units/matrix units/lineinfo units/ucomplex units/fpwidestring units/cpu
  134. TESTPACKAGESUBDIRS=packages/win-base packages/webtbs packages/hash packages/fcl-registry packages/fcl-process packages/zlib packages/fcl-db packages/fcl-base packages/fcl-xml packages/cocoaint packages/bzip2
  135. ifdef QUICKTEST
  136. export QUICKTEST
  137. else
  138. override TESTSUBDIRS+=$(TESTPACKAGESUBDIRS) alglib
  139. endif
  140. # number of tests to run per (potentially parallel) chunk/dotest invocation
  141. ifndef CHUNKSIZE
  142. export CHUNKSIZE:=100
  143. endif
  144. # All full dirnames in the test/ dir including the subdir self
  145. TESTDIRS:=test $(addprefix test/,$(TESTSUBDIRS))
  146. .PHONY: utils tstunits copyfiles testprep
  147. ################################
  148. # Utilities
  149. #
  150. utils:
  151. $(MAKE) -C utils utils
  152. utilsdb:
  153. $(MAKE) -C utils utilsdb
  154. ifndef DIGEST
  155. DIGEST=utils/digest
  156. endif
  157. ifndef DOTEST
  158. DOTEST=utils/dotest
  159. endif
  160. ifndef CONCAT
  161. CONCAT=utils/concat
  162. endif
  163. ifndef GPARMAKE
  164. GPARMAKE=./gparmake$(EXEEXT)
  165. endif
  166. ifndef PREPUP
  167. PREPUP=utils/prepup
  168. endif
  169. ################################
  170. # Units
  171. #
  172. tstunits:
  173. ifdef inOS2
  174. $(MAKE) -C tstunits FPC_VERSION= FPC=$(TEST_FPC) CPU_TARGET=$(TEST_CPU_TARGET) OS_TARGET=$(TEST_OS_TARGET) "OPT=$(TEST_OPT)" CCOMPILER=$(TEST_CCOMPILER) BINUTILSPREFIX=$(TEST_BINUTILSPREFIX)
  175. else
  176. $(MAKE) -C tstunits FPC_VERSION= FPC=$(TEST_FPC) CPU_TARGET=$(TEST_CPU_TARGET) OS_TARGET=$(TEST_OS_TARGET) 'OPT=$(TEST_OPT)' CCOMPILER=$(TEST_CCOMPILER) BINUTILSPREFIX=$(TEST_BINUTILSPREFIX)
  177. endif
  178. ################################
  179. # Copy test environment dependent files ctest.o, cext3.o, cext4.o to test/cg etc
  180. #
  181. .PHONY: create_c_objects delete_c_objects copyfiles test_c_objects
  182. C_SOURCE_DIR=test/cg/obj
  183. C_SOURCES=ctest.c tcext3.c tcext4.c tcext5.c tcext6.c
  184. CPP_SOURCES=cpptcl1.cpp cpptcl2.cpp
  185. ifneq ($(TEST_ABI),)
  186. C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)
  187. else
  188. C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)
  189. endif
  190. C_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .c,.o, $(C_SOURCES)))
  191. CPP_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .cpp,.o, $(CPP_SOURCES)))
  192. create_c_objects:
  193. ifneq ($(TEST_CCOMPILER),)
  194. -$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(C_SOURCES)) $(C_OBJECTS_DIR)
  195. $(MAKE) $(C_OBJECTS)
  196. -$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(CPP_SOURCES)) $(C_OBJECTS_DIR)
  197. $(MAKE) $(CPP_OBJECTS)
  198. -$(DEL) $(addprefix $(C_OBJECTS_DIR)/, $(C_SOURCES) $(CPP_SOURCES))
  199. else
  200. $(ECHO) create_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
  201. $(ECHO) TEST_CFLAGS variable is passed as options is used to compile the objects
  202. endif
  203. delete_c_objects:
  204. ifneq ($(TEST_CCOMPILER),)
  205. -$(DEL) $(C_OBJECTS) $(CPP_OBJECTS)
  206. else
  207. $(ECHO) delete_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
  208. $(ECHO) to be able to recompile the objects using create_objects rule.
  209. endif
  210. $(C_OBJECTS) : %.o: %.c
  211. $(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
  212. $(CPP_OBJECTS) : %.o: %.cpp
  213. $(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
  214. copyfiles: $(TEST_OUTPUTDIR)
  215. -$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/cg
  216. -$(COPY) $(C_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
  217. -$(COPY) $(CPP_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
  218. -$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/units/system
  219. ################################
  220. # Preparation for tests
  221. #
  222. testprep: testprep-stamp.$(TEST_FULL_TARGET)
  223. testprep-stamp.$(TEST_FULL_TARGET): utils tstunits copyfiles
  224. $(ECHOREDIR) $(DATE) > testprep-stamp.$(TEST_FULL_TARGET)
  225. $(TEST_OUTPUTDIR):
  226. $(MKDIRTREE) $@
  227. ################################
  228. # Dotest options
  229. #
  230. ifneq ($(TEST_FPC),ppc386$(EXEEXT))
  231. ifeq ($(findstring -c$(TEST_FPC),$(DOTESTOPT)),)
  232. override DOTESTOPT+=-c$(TEST_FPC)
  233. endif
  234. endif
  235. ifneq ($(FULL_TARGET),$(TEST_FULL_TARGET))
  236. override DOTESTOPT+=-T$(TEST_FULL_TARGET)
  237. endif
  238. ifneq ($(TEST_BINUTILSPREFIX),)
  239. override DOTESTOPT+=-Y-XP$(TEST_BINUTILSPREFIX) -Y-Xd
  240. endif
  241. # Don't use comspec for dos:
  242. # command.com returns 0 if it manages to execute a program
  243. # regardless of the program's exit code
  244. ifdef inDOS
  245. override DOTESTOPT+=-X
  246. endif
  247. ifdef TEST_RSH
  248. override DOTESTOPT+=-R$(TEST_RSH)
  249. endif
  250. ifdef TEST_SSH
  251. override DOTESTOPT+=-R$(TEST_SSH) -S
  252. endif
  253. ifdef TEST_REMOTEPATH
  254. override DOTESTOPT+=-P$(TEST_REMOTEPATH)
  255. endif
  256. ifdef TEST_DELBEFORE
  257. override DOTESTOPT+=-B
  258. endif
  259. ifdef TEST_DELTEMP
  260. override DOTESTOPT+=-Z
  261. endif
  262. ifdef TEST_TIMEOUT
  263. override DOTESTOPT+=-O
  264. endif
  265. ifdef TEST_VERBOSE
  266. override DOTESTOPT+=-V
  267. endif
  268. # Also display benchmarks
  269. ifdef TEST_BENCH
  270. override DOTESTOPT+=-D
  271. endif
  272. ifdef V
  273. Q=
  274. QECHO=
  275. else
  276. Q=@
  277. QECHO=@echo $(1)
  278. endif
  279. ifdef TEST_REMOTEOPT
  280. override DOTESTOPT+=-U$(TEST_REMOTEOPT)
  281. endif
  282. ifdef TEST_PUTTY
  283. override DOTESTOPT+=-R$(TEST_PUTTY) -W
  284. endif
  285. ifdef TEST_ADB
  286. override DOTESTOPT+=-ADB -R$(TEST_ADB)
  287. endif
  288. ifdef TEST_OPT
  289. # handles several options as well
  290. override DOTESTOPT+=$(addprefix -Y, $(TEST_OPT))
  291. endif
  292. ifdef TEST_REMOTEPW
  293. # handles several options as well
  294. override DOTESTOPT+=-U-pw -U$(TEST_REMOTEPW)
  295. endif
  296. ifdef GRAPH
  297. override DOTESTOPT+=-g
  298. endif
  299. ifdef INTERACTIVE
  300. override DOTESTOPT+=-i
  301. endif
  302. ifdef DOALL
  303. override DOTESTOPT+=-a
  304. endif
  305. ifdef EMULATOR
  306. override DOTESTOPT+=-M$(EMULATOR)
  307. endif
  308. ifdef USEENV
  309. override DOTESTENV:=$(DOTESTOPT)
  310. override DOTESTOPT=!DOTESTENV
  311. export DOTESTENV
  312. endif
  313. ################################
  314. # Run tests
  315. #
  316. DIRS=webtbs webtbf tbs tbf $(TESTDIRS)
  317. vpath %.log $(TEST_OUTPUTDIR)
  318. vpath %.elg $(TEST_OUTPUTDIR)
  319. vpath %.o $(C_SUBDIR)
  320. ifdef SINGLEDOTESTRUNS
  321. TBSREQ=$(patsubst %.pp,%.elg,$(sort $(wildcard tbs/t*.pp)))
  322. TBFREQ=$(patsubst %.pp,%.elg,$(sort $(wildcard tbf/t*.pp)))
  323. WEBTBSREQ=$(patsubst %.pp,%.elg,$(sort $(wildcard webtbs/t*.pp)))
  324. WEBTBFREQ=$(patsubst %.pp,%.elg,$(sort $(wildcard webtbf/t*.pp)))
  325. TESTREQ=$(patsubst %.pp,%.elg,$(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS)))))
  326. else
  327. TBSREQ=$(TEST_OUTPUTDIR)/tbsdir-stamp.$(TEST_FULL_TARGET)
  328. TBFREQ=$(TEST_OUTPUTDIR)/tbfdir-stamp.$(TEST_FULL_TARGET)
  329. WEBTBSREQ=$(TEST_OUTPUTDIR)/webtbsdir-stamp.$(TEST_FULL_TARGET)
  330. WEBTBFREQ=$(TEST_OUTPUTDIR)/webtbfdir-stamp.$(TEST_FULL_TARGET)
  331. TESTREQ=$(TEST_OUTPUTDIR)/testdir-stamp.$(TEST_FULL_TARGET)
  332. endif
  333. %.log : %.pp testprep-stamp.$(TEST_FULL_TARGET)
  334. $(call QECHO," COMPILE $<")
  335. $(Q)$(DOTEST) $(DOTESTOPT) $<
  336. %.elg : %.pp testprep-stamp.$(TEST_FULL_TARGET)
  337. $(call QECHO," EXECUTE $<")
  338. $(Q)$(DOTEST) $(DOTESTOPT) -e $<
  339. ifdef TEST_CCOMPILER
  340. %.o : %.c
  341. $(TEST_CCOMPILER) -c $< -o $(@D)/$(C_SUBDIR)/$(@F)
  342. %.o : %.cc
  343. $(TEST_CCOMPILER) -c $< -o $(@D)/$(C_SUBDIR)/$(@F)
  344. endif
  345. ################################
  346. # Compile tests
  347. #
  348. .PHONY: alltbs alltbf allwebtbs allwebtbf alltest alltests
  349. alltbs : testprep $(patsubst %.pp,%.log,$(sort $(wildcard tbs/t*.pp)))
  350. alltbf : testprep $(patsubst %.pp,%.log,$(sort $(wildcard tbf/t*.pp)))
  351. allwebtbs : testprep $(patsubst %.pp,%.log,$(sort $(wildcard webtbs/t*.pp)))
  352. allwebtbf : testprep $(patsubst %.pp,%.log,$(sort $(wildcard webtbf/t*.pp)))
  353. alltest : testprep $(patsubst %.pp,%.log,$(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS)))))
  354. ifndef SINGLEDOTESTRUNS
  355. $(Q)$(DOTEST) $(DOTESTOPT) -e $(wildcard $(addsuffix /t*.pp,$(TESTDIRS)))
  356. endif
  357. alltests: alltest alltbs alltbf allwebtbs allwebtbf
  358. test_c_objects: testprep
  359. $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcalext*.pp)))
  360. $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcalext*.pp)))
  361. $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcppcl*.pp)))
  362. $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcppcl*.pp)))
  363. ################################
  364. # Compile and Run tests
  365. #
  366. ifdef SINGLEDOTESTRUNS
  367. .PHONY: allexectbs allexectbf allexecwebtbs allexecwebtbf allexectest allexectests
  368. allexectbs: $(addsuffix .tbslog, $(LOGFILES))
  369. allexectbf: $(addsuffix .tbflog, $(LOGFILES))
  370. allexecwebtbs: $(addsuffix .webtbslog, $(LOGFILES))
  371. allexecwebtbf: $(addsuffix .webtbflog, $(LOGFILES))
  372. allexectest: $(addsuffix .testlog, $(LOGFILES))
  373. $(TEST_OUTPUTDIR)/%.mergedlog : $(TEST_OUTPUTDIR)/%.testlog $(TEST_OUTPUTDIR)/%.tbslog $(TEST_OUTPUTDIR)/%.tbflog $(TEST_OUTPUTDIR)/%.webtbslog $(TEST_OUTPUTDIR)/%.webtbflog
  374. $(Q)$(CONCAT) $^ $@
  375. $(Q)$(COPY) $@ $(basename $@)
  376. $(TEST_OUTPUTDIR)/%.tbslog : $(TBSREQ)
  377. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/faillist.tbslog
  378. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/longlog.tbslog
  379. $(TEST_OUTPUTDIR)/%.tbflog : $(TBFREQ)
  380. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/faillist.tbflog
  381. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/longlog.tbflog
  382. $(TEST_OUTPUTDIR)/%.webtbslog : $(WEBTBSREQ)
  383. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/faillist.webtbslog
  384. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/longlog.webtbslog
  385. $(TEST_OUTPUTDIR)/%.webtbflog : $(WEBTBFREQ)
  386. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/faillist.webtbflog
  387. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/longlog.webtbflog
  388. $(TEST_OUTPUTDIR)/%.testlog : $(TESTREQ)
  389. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/faillist.testlog
  390. $(Q)$(ECHO) -n >> $(TEST_OUTPUTDIR)/longlog.testlog
  391. # run all tests, then merge log files
  392. allexectests: $(TEST_OUTPUTDIR)/log.testlog $(TEST_OUTPUTDIR)/log.tbslog \
  393. $(TEST_OUTPUTDIR)/log.tbflog $(TEST_OUTPUTDIR)/log.webtbslog \
  394. $(TEST_OUTPUTDIR)/log.webtbflog \
  395. $(addprefix $(TEST_OUTPUTDIR)/,$(foreach EXT, $(LOGEXT), $(addsuffix $(EXT), faillist longlog))) \
  396. $(addsuffix .mergedlog, $(LOGFILES))
  397. # SINGLEDOTESTRUNS
  398. else
  399. .PHONY: allexectests gparmake_allexectests
  400. MAKEINC=$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
  401. $(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp
  402. $(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
  403. # Can't have testprep as prerequisite, because that is a phony target and
  404. # phony targets are always remade. Since the makefile will be reparsed
  405. # after making the MakeChunks file (because it has to be included) and all
  406. # up-to-date checks will be re-evaluated, this means that the testprep rule
  407. # (or testprep timestamp file, which depends on phony rules and hence has
  408. # the same behaviour) will always be considered newer than the MakeChunks
  409. # file and hence the MakeChunks will be regenerated in an infinite loop
  410. # (although some make versions appear to contain a bug that prevents this
  411. # from happening)
  412. # As a result, we list TEST_OUTPUTDIR as a dependency (that just creates
  413. # the directory) and have an explicit rule to build GPARMAKE rather than
  414. # building it via the utils Makefile
  415. $(MAKEINC): $(GPARMAKE) $(TEST_OUTPUTDIR)
  416. # generate rules for parallel executions of dotest
  417. # gparmake now also needs an additional parameter for the name of the
  418. # used subdirectory. Note also that the index must be increasing for each
  419. # new call with a gap insuring that all the previous files have lower index
  420. # even if CHUNKSIZE is equal to 1.
  421. $(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) $(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
  422. $(Q)$(GPARMAKE) -a $(MAKEINC) tbs 10000 $(CHUNKSIZE) $(sort $(wildcard tbs/t*.pp))
  423. $(Q)$(GPARMAKE) -a $(MAKEINC) tbf 15000 $(CHUNKSIZE) $(sort $(wildcard tbf/t*.pp))
  424. $(Q)$(GPARMAKE) -a $(MAKEINC) webtbs 20000 $(CHUNKSIZE) $(sort $(wildcard webtbs/t*.pp))
  425. $(Q)$(GPARMAKE) -a $(MAKEINC) webtbf 30000 $(CHUNKSIZE) $(sort $(wildcard webtbf/t*.pp))
  426. # only include the targets to compile/run the tests when we want to
  427. # run them (in particular: not when cleaning)
  428. ifeq (,$(findstring clean,$(firstword $(MAKECMDGOALS))))
  429. ifneq (,$(findstring all,$(MAKECMDGOALS)))
  430. ifneq (,$(wildcard $(MAKEINC)))
  431. # incude the rules we just generated
  432. include $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
  433. endif
  434. endif
  435. endif
  436. # this is pretty cool: MakeChunks-$(TEST_TARGETSUFFIX).inc will contain
  437. # additional prerequisites for the allexectests target, and after it is
  438. # generated it will be included by the above "include" statement, and those
  439. # additional prerequisites will be added on the fly and also be evaluated.
  440. # However, to avoid problems on some targets that seem to have problems
  441. # handling missing include files, we first create MAKEINC file
  442. # and rerun MAKE with gparmake_allexectests target.
  443. allexectests: $(MAKEINC)
  444. $(MAKE) gparmake_allexectests
  445. # SINGLEDOTESTRUNS
  446. endif
  447. ################################
  448. # Clean
  449. #
  450. .PHONY: clean distclean clean_test clean_sources
  451. # Remove any possible PPU files
  452. clean_sources:
  453. -$(DEL) $(wildcard $(patsubst %.pp,%$(PPUEXT),$(wildcard $(addsuffix /*.pp,$(DIRS)))))
  454. clean_test:
  455. -$(DELTREE) $(TEST_OUTPUTDIR)
  456. -$(DEL) core gmon.out testprep-stamp.$(TEST_FULL_TARGET) dotgz$(SRCBATCHEXT)
  457. clean: clean_sources fpc_clean
  458. $(MAKE) clean_test CPU_TARGET=$(TEST_CPU_TARGET) OS_TARGET=$(TEST_OS_TARGET)
  459. $(MAKE) -C tstunits clean CPU_TARGET=$(TEST_CPU_TARGET) OS_TARGET=$(TEST_OS_TARGET)
  460. distclean: clean fpc_distclean
  461. $(DELTREE) output
  462. $(MAKE) -C utils distclean
  463. $(MAKE) -C tstunits distclean
  464. -$(DEL) testprep-stamp.*
  465. #cleanall: clean
  466. # $(MAKE) -C utils cleanall
  467. ################################
  468. # Main rules
  469. #
  470. .PHONY: all full digest onlyknown onlygraph onlyinteractive
  471. digest : utils
  472. -$(DIGEST) $(LOG)
  473. SVNVERSION:=$(firstword $(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH))))
  474. ifneq ($(SVNVERSION),)
  475. SVN_TESTS_REV_STR=$(shell $(SVNVERSION) -c .)
  476. SVN_COMPILER_REV_STR=$(shell $(SVNVERSION) -c ../compiler)
  477. SVN_RTL_REV_STR=$(shell $(SVNVERSION) -c ../rtl)
  478. SVN_PACKAGES_REV_STR=$(shell $(SVNVERSION) -c ../packages)
  479. endif
  480. $(TEST_OUTPUTDIR)/dbdigest.cfg:
  481. $(ECHOREDIR) OS=$(TEST_OS_TARGET) > $(TEST_OUTPUTDIR)/dbdigest.cfg
  482. $(ECHOREDIR) CPU=$(TEST_CPU_TARGET) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  483. $(ECHOREDIR) Version=$(TEST_FPC_VERSION) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  484. $(ECHOREDIR) LogFile=log >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  485. ifneq ($(TEST_USE_LONGLOG),)
  486. $(ECHOREDIR) LongLogFile=longlog >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  487. endif
  488. $(ECHOREDIR) Submitter=$(TEST_USER) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  489. $(ECHOREDIR) Machine=$(TEST_HOSTNAME) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  490. $(ECHOREDIR) Comment=$(TEST_OPT) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  491. ifneq ($(TEST_DATETIME),)
  492. $(ECHOREDIR) Date=$(TEST_DATETIME) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  493. endif
  494. ifneq ($(TEST_FPC_DATE),)
  495. $(ECHOREDIR) CompilerDate=$(TEST_FPC_DATE) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  496. endif
  497. ifneq ($(TEST_FPC_FULLVERSION),)
  498. $(ECHOREDIR) CompilerFullVersion=$(TEST_FPC_FULLVERSION) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  499. endif
  500. ifneq ($(SVNVERSION),)
  501. $(ECHOREDIR) svntestsrevision=$(SVN_TESTS_REV_STR) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  502. $(ECHOREDIR) svncompilerrevision=$(SVN_COMPILER_REV_STR) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  503. $(ECHOREDIR) svnrtlrevision=$(SVN_RTL_REV_STR) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  504. $(ECHOREDIR) svnpackagesrevision=$(SVN_PACKAGES_REV_STR) >> $(TEST_OUTPUTDIR)/dbdigest.cfg
  505. endif
  506. # OpenBSD system tar executable doesn't know
  507. # about --files-from option, but supports -I
  508. ifeq ($(OS_SOURCE),openbsd)
  509. TARFROM=-I tar.lst
  510. else
  511. TARFROM=--files-from=tar.lst
  512. endif
  513. # Pass option -ll to perpup if we use longlog file
  514. # instead of add all *.log and *.elg files to DB_TARGZ
  515. ifneq ($(TEST_USE_LONGLOG),)
  516. PREPUP_OPT=-ll
  517. else
  518. PREPUP_OPT=
  519. endif
  520. ifndef inWinDOS
  521. $(TEST_OUTPUTDIR)/tar.lst:
  522. ifdef inOS2
  523. cd $(subst /,\,$(TEST_OUTPUTDIR)) && gnufind . -name "*.log" -o -name "*.elg" > tar.lst
  524. $(ECHOREDIR) log>> $(TEST_OUTPUTDIR)/tar.lst
  525. $(ECHOREDIR) dbdigest.cfg>> $(TEST_OUTPUTDIR)/tar.lst
  526. else
  527. ifeq ($(TEST_USE_LONGLOG),)
  528. cd $(TEST_OUTPUTDIR) && find . -name '*.log' -o -name '*.elg' > tar.lst
  529. else
  530. $(ECHOREDIR) "longlog" > $(TEST_OUTPUTDIR)/tar.lst
  531. endif
  532. $(ECHOREDIR) "log" >> $(TEST_OUTPUTDIR)/tar.lst
  533. $(ECHOREDIR) "dbdigest.cfg" >> $(TEST_OUTPUTDIR)/tar.lst
  534. endif
  535. $(TEST_OUTPUTDIR)/$(DB_TARGZ): $(TEST_OUTPUTDIR)/tar.lst $(TEST_OUTPUTDIR)/dbdigest.cfg
  536. ifdef inCygWin
  537. dos2unix $(TEST_OUTPUTDIR)/tar.lst
  538. endif
  539. ifdef inOS2
  540. dos2unix $(TEST_OUTPUTDIR)/tar.lst
  541. cd $(subst /,\,$(TEST_OUTPUTDIR)) && $(TARPROG) czf $(DB_TARGZ) $(TARFROM)
  542. else
  543. cd $(TEST_OUTPUTDIR) && $(TARPROG) czf $(DB_TARGZ) $(TARFROM)
  544. endif
  545. else
  546. $(TEST_OUTPUTDIR)/$(DB_TARGZ): $(TEST_OUTPUTDIR)/dbdigest.cfg
  547. ifdef inDOS
  548. $(ECHOREDIR) @echo off > dotgz$(SRCBATCHEXT)
  549. $(ECHOREDIR) cd $(subst /,\,$(TEST_OUTPUTDIR)) >> dotgz$(SRCBATCHEXT)
  550. $(ECHOREDIR) $(subst /,\,../../$(PREPUP)) $(DB_TARGZ) >> dotgz$(SRCBATCHEXT)
  551. $(ECHOREDIR) if errorlevel 1 $(DEL) $(DB_TARGZ) >> dotgz$(SRCBATCHEXT)
  552. $(ECHOREDIR) cd $(subst /,\,../../) >> dotgz$(SRCBATCHEXT)
  553. $(RUNBATCH) dotgz$(SRCBATCHEXT)
  554. else
  555. ifdef inOS2
  556. cd "$(subst /,\,$(TEST_OUTPUTDIR))" && "..\..\$(PREPUP)" $(DB_TARGZ)
  557. else
  558. cd "$(TEST_OUTPUTDIR)" && "../../$(PREPUP)" $(DB_TARGZ)
  559. endif
  560. endif
  561. endif
  562. # Use Putty, unless we set DB_USE_SSH to force ssh usage
  563. # Useful for cygwin
  564. ifndef DB_USE_SSH
  565. ifdef inWinDOS
  566. UsePutty=1
  567. endif
  568. endif
  569. uploadrun: $(TEST_OUTPUTDIR)/$(DB_TARGZ)
  570. ifdef UsePutty
  571. pscp -load "[email protected]" $(TEST_OUTPUTDIR)/$(DB_TARGZ) $(DB_HOST):$(DB_UPLOADDIR)/$(DB_TARGZ).part $(SSH_EXTRA)
  572. plink -load "[email protected]" "mv $(DB_UPLOADDIR)/$(DB_TARGZ).part $(DB_UPLOADDIR)/$(DB_TARGZ)"
  573. else
  574. scp $(DB_SSH_EXTRA) $(TEST_OUTPUTDIR)/$(DB_TARGZ) $(DB_HOST):$(DB_UPLOADDIR)/$(DB_TARGZ).part
  575. ifdef inOS2
  576. $(ECHOREDIR) . | ssh $(DB_SSH_EXTRA) $(DB_HOST) "mv $(DB_UPLOADDIR)/$(DB_TARGZ).part $(DB_UPLOADDIR)/$(DB_TARGZ)"
  577. else
  578. ssh $(DB_SSH_EXTRA) $(DB_HOST) "mv $(DB_UPLOADDIR)/$(DB_TARGZ).part $(DB_UPLOADDIR)/$(DB_TARGZ)"
  579. endif
  580. endif
  581. all : allexectests
  582. full :
  583. $(MAKE) clean
  584. $(MAKE) allexectests
  585. $(MAKE) digest
  586. fulldb :
  587. $(MAKE) clean
  588. $(MAKE) allexectests
  589. $(MAKE) digest
  590. $(MAKE) uploadrun
  591. tarfile : $(TEST_OUTPUTDIR)/$(DB_TARGZ)
  592. onlyknown :
  593. $(MAKE) full "DOTESTOPT= $(DOTESTOPT) -k-"
  594. onlygraph :
  595. $(MAKE) full "DOTESTOPT= $(DOTESTOPT) -g-"
  596. onlyinteractive :
  597. $(MAKE) "DOTESTOPT= $(DOTESTOPT) -i-"
  598. info :
  599. @$(ECHO) "This Makefile allows to test the compiler"
  600. @$(ECHO)
  601. @$(ECHO) "Basic Targets:"
  602. @$(ECHO) " all - continue all tests"
  603. @$(ECHO) " full - clean and run all tests"
  604. @$(ECHO) " fulldb - full and upload test results"
  605. @$(ECHO) " digest - compute and print test statistics"
  606. @$(ECHO)
  607. @$(ECHO) "Advanced Targets:"
  608. @$(ECHO) " onlyknown - run only known bugs"
  609. @$(ECHO) " onlygraph - run only graph tests"
  610. @$(ECHO) " onlyinteractive - run only interactive tests"
  611. @$(ECHO)
  612. @$(ECHO) "Host environment:"
  613. @$(ECHO) " $(FULL_TARGET)"
  614. @$(ECHO) " compiler: $(FPC) ver: $(FPC_VERSION)"
  615. @$(ECHO)
  616. @$(ECHO) "Test environment:"
  617. @$(ECHO) " $(TEST_FULL_TARGET)"
  618. @$(ECHO) " compiler: $(TEST_FPC) ver: $(TEST_FPC_VERSION)"
  619. @$(ECHO)
  620. @$(ECHO) "Output settings:"
  621. @$(ECHO) " DateTime : $(TEST_DATETIME)"
  622. @$(ECHO) " Outputdir: $(TEST_OUTPUTDIR)"
  623. @$(ECHO) " Uploaddir: $(DB_UPLOADDIR)"
  624. @$(ECHO) " tar.gz : $(DB_TARGZ)"