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