readme.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. Usage
  2. -----
  3. To start the test suite execute:
  4. make full TEST_FPC=path_to_your_compiler
  5. This should run all tests, scan the created log file and output some
  6. statistics.
  7. make digest TEST_FPC=path_to_your_compiler
  8. scans the created log file and outputs some statistics
  9. make digest USESQL=YES TEST_FPC=path_to_your_compiler
  10. sends the results to an SQL database
  11. When the tests are performed, first the units (e.g. rtl) needed by the
  12. tests are compiled in a clean determined way and put in the units
  13. directory. Then webtbs/webtbf/test/tbs/tbf are searched for t*.pp to be
  14. compiled and executed as tests.
  15. Parallel test suite runs
  16. ------------------------
  17. It is possible to run the test suite in parallel, but only when using the
  18. "all", "full" or "fulldb" targets and only if SINGLEDOTESTRUNS is not used.
  19. Under those circumstances, it is safe to use -jx, with x the number of tests
  20. that can be compiled and run in parallel. E.g.
  21. make full TEST_FPC=path_to_your_compiler -j 2
  22. Make sure to clean the test suite between two runs for the same platform.
  23. Directories
  24. -----------
  25. webtbs...........Tests for web-bug-database bugs (should compile/run)
  26. Digits in filename refer to bug database entry
  27. webtbf...........Tests for web-bug-database bugs (should not compile/run)
  28. Digits in filename refer to bug database entry
  29. test.............Test suites for different aspects of the compiler/rtl etc
  30. test/packages....Tests depending on packages. The tests are sorted by package
  31. though this is not mandatory because tests can depend on
  32. multiple packages
  33. tbs..............Tests for other bugs, added by the fpc core team
  34. (success in compilation) Digits in filename is a serial no
  35. tbf..............Tests for other bugs, added by the fpc core team
  36. (fail compile) Digits in filename is a serial no
  37. units............Helper units for doing the tests
  38. utils............Utilities for processing tests
  39. Writing a test
  40. --------------
  41. A test should have a name on the form t*.pp, to be recognized as a test.
  42. It should return 0 on success, any other value indicates failure.
  43. Test directives
  44. ---------------
  45. At the top of the test source code, some directives can be used to
  46. determine how the tests will be processed (if processed automatically via
  47. make), e.g. {%CPU=i386}:
  48. OPT................Compiler option required to compile
  49. CPU................Only for these CPU's (i386,m68k,etc). Might be a list.
  50. SKIPCPU............Not for these CPU's (i386,m68k,etc). Might be a list.
  51. TARGET.............Only for these OS targets (win32,MacOS,etc).
  52. Might be a list.
  53. SKIPTARGET.........Not for these OS targets (win32,MacOS,etc).
  54. Might be a list.
  55. VERSION............Compiler with at lest this version number required.
  56. MAXVERSION.........Compiler with at most this version number required.
  57. RESULT.............Exit code of execution of test expected
  58. TIMEOUT............Timeout indication for test in seconds (only used if
  59. enabled by defining TEST_TIMEOUT)
  60. FILES..............List of files (separated by spaces) required by test,
  61. will be copied to remote before execution. If TEST_DELTEMP
  62. is set, all these files will be deleted after the test.
  63. DELFILES...........List of files (separated by spaces) to be deleted after
  64. the test. Files will be deleted only if TEST_DELTEMP is
  65. set. If no extension is specified for a file, the dotest
  66. program will try to delete executable and shared library
  67. of that name, using appropriate exe and dll extensions
  68. CONFIGFILE Specifies a file in ./config that is to be copied to the
  69. test. If two names are given the first is the source filename
  70. and the second is the destination filename. If only one is
  71. given than it acts both as source and destination filename.
  72. GRAPH..............Requires graph unit
  73. FAIL...............Compilation must fail
  74. RECOMPILE..........After compiling a test, recompile the test for a second
  75. time. This is needed to test ppu loading issues. Can
  76. optionally specify a command line option to use only
  77. during the second compilation.
  78. NORUN..............Do not execute test, only compile it
  79. INTERACTIVE........Do not execute test, as it requires user intervention
  80. NOTE...............Output note when compiling/executing test
  81. NEEDLIBRARY........Adds -rpath to the linker for unix. This is needed to
  82. test runtime library tests. The library needs the -FE.
  83. option to place the .so in the correct directory.
  84. NEEDEDAFTER........Use it if the files are necessary for a later test.
  85. this option will avoid deleting generated file even when
  86. TEST_DELTEMP is used.
  87. KNOWNRUNERROR......Known bug, which manifest itself at runtime. To the
  88. right of the equal sign is the expected exit code,
  89. followed by an optional note. Will not be logged
  90. as a bug.
  91. KNOWNCOMPILEERROR..Known bug, which manifest itself at compile time. To
  92. the right of the equal sign is the expected exit code
  93. from compiler, followed by an optional note. Will not
  94. be logged as a bug.
  95. EXPECTMSGS.........A comma separated list of message IDs (see -vq) which the
  96. compiler is expected to print during execution. If at least
  97. one is not printed then this is considered an error.
  98. Note: implicitly adds the -vq option for compilation.
  99. QUICKTEST..........If set, only tests without package dependencies are executed
  100. WPOPARAS...........Parameters to be added after -OW/-Ow to perform whole
  101. program optimization tests
  102. WPOPASSES..........Number of whole program optimization iterations to perform
  103. ("1" means compile once with "-FWsomefile -OW<wpoparas>"
  104. and then again with "-FWsomefile2 -OW<wpoparas>
  105. -Fwsomefile1 -Ow<wpoparas>", "2" means another pass but
  106. using somefile2 as input and somefile3 as output, etc.)
  107. NOTE: A list consists of comma separated items, e. g. CPU=i386,m68k,powerpc
  108. No space between the elements and the comma.
  109. Controling testing in more detail
  110. ---------------------------------
  111. Calling "make full" will perform tests in a standard manner. To have
  112. more control of the test process one must distinguish between:
  113. * Driver environment: compiler/rtl etc. to be used by the tools which
  114. runs and analyze the tests. All normal options to make, like FPC
  115. OS_TARGET, OPT etc. controls this.
  116. * Test environment: compiler/rtl etc. to be tested, to be used
  117. *in* the tests. Ususal options, prepended with TEST_ , controls
  118. this. If no such options are given, test and driver environment
  119. will be the same.
  120. This differentiation also enables cross testing.
  121. The following test options can be given:
  122. TEST_FPC compiler to test (no default)
  123. TEST_OS_TARGET defaults to default target of TEST_FPC
  124. TEST_CPU_TARGET defaults to default target of TEST_FPC
  125. TEST_OPT defaults to ""
  126. TEST_FPC_VERSION defaults to version of TEST_FPC
  127. TEST_CCOMPILER defaults to installed gcc compiler, but only
  128. if driver and test full-targets are the same.
  129. TEST_VERBOSE let dotest be more verbose, only useful for debugging
  130. TEST_BENCH display compilation/execution time of each test
  131. TEST_DELTEMP delete temporary executable/object/ppu file,
  132. default is off
  133. TEST_TIMEOUT use timeout wrapper for (remote) execution
  134. V print dotest commandline
  135. TEST_ABI test a certain abi, this influences where the
  136. c object files are taken from: TEST_ABI=eabi
  137. takes the c*.o files from
  138. test/cg/obj/linux/arm-eabi
  139. CHUNKSIZE Number of tests per chunk that can be potentially executed
  140. in parallel with other chunks
  141. (Please add more test options if needed)
  142. NOTE: To clean after a test session, "make clean TEST_FPC=path_to_your_compiler"
  143. must be given the same options as when running the tests.
  144. The utils directory is considerd to belong to the driver environment,
  145. all other directories belong to the test environment.
  146. Remote execution
  147. ----------------
  148. Also remote execution of the test suite is possible.
  149. Requirements:
  150. - rsh/ssh must work without keyboard interaction or extra parameters
  151. Test options:
  152. TEST_RSH set this to the hostname when you want to use rsh/rcp
  153. to execute/copy the test
  154. TEST_SSH set this to use ssh/scp to execute the test
  155. TEST_PUTTY test using putty when remote testing (pscp and plink)
  156. TEST_ADB run tests on a remote Android device using ADB. Specify
  157. TEST_ADB=1 to run on a default connected device. Specify
  158. TEST_ADB=<serial> to run on a specific connected device.
  159. TEST_REMOTEOPT extra options to remote program
  160. TEST_REMOTEPATH set remote path to use, default is /tmp
  161. TEST_DELBEFORE delete remote executable before uploading
  162. TEST_DELTEMP delete executable after running, so the remote system
  163. doesn't need much free disk space
  164. TEST_REMOTEPW pass a password with -pw to remote tools,
  165. mainly useful for putty
  166. Examples:
  167. -------
  168. make TEST_FPC=$HOME/fpc/compiler/ppcsparc TEST_BINUTILSPREFIX=sparc-linux- \
  169. TEST_RSH=sunny TEST_REMOTEPATH=/tmp/tests
  170. make TEST_FPC=$HOME/fpc/compiler/ppcsparc TEST_BINUTILSPREFIX=sparc-linux- \
  171. TEST_SSH=fpc@sunny TEST_REMOTEPATH=/tmp/tests
  172. Example for win32/putty:
  173. make TEST_FPC=c:\fpc\compiler\ppcarm TEST_BINUTILSPREFIX=arm-linux- \
  174. [email protected] TEST_REMOTEPATH=/tmp TEST_DELTEMP=1 \
  175. "TEST_REMOTEPW=xxx" FPC=c:\fpc\compiler\ppc386
  176. Emulator execution
  177. ------------------
  178. Emulator execution is possible as well. It can't be combined with remote
  179. execution though.
  180. EMULATOR: name of the emulator to use
  181. EMULATOR_OPTS: pass the given options to the emulator
  182. Examples:
  183. make TEST_FPC=~/fpc/compiler/ppcrossarm TEST_OPT=-XParm-linux- \
  184. EMULATOR=qemu-arm
  185. make TEST_FPC=~/fpc/compiler/ppcrossarm TEST_OPT=-XParm-linux- \
  186. EMULATOR=qemu-arm digest DBDIGESTOPT="-C qemu-arm" USESQL=YES
  187. Example cross testing of target Mac OS with driver Darwin
  188. --------------------------------------------------------
  189. NOTE: Today, it is possible to run the test suite Mac OS native.
  190. A machine with both Mac OS X and classic Mac OS installed is required.
  191. Note that make will not run the tests. This has to be done in MPW with the
  192. scripts in utils/MacOS.
  193. make clean alltest TEST_OS_TARGET=MacOS TEST_OPT="-WT -st" \
  194. USEUNITDIR=/Projekt/Freepascal/fpc/rtl/MacOS
  195. To clean. Note that same options as above has to be given so that the
  196. correct files will be removed.
  197. make clean TEST_OS_TARGET=MacOS USEUNITDIR=/Projekt/Freepascal/fpc/rtl/MacOS
  198. Example cross testing of target arm-wince
  199. -----------------------------------------
  200. //arm-wince example:
  201. see FPCTRUNK\DEMO\WINCE\TESTEMU\ for additionally required tools
  202. Connect your device via ActiveSync and execute:
  203. make TEST_FPC=ppcrossarm TEST_CPU_TARGET=arm TEST_OS_TARGET=wince \
  204. TEST_OPT="-XParm-wince- -WC -Xs" \
  205. EMULATOR=MyDisc:\My\Path\to\wcetemu.exe
  206. Tests will be performed in the \fpctests folder on the device.
  207. Result uploading
  208. ----------------
  209. Results can be uploaded to the test suite result DB
  210. (http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi) by executing
  211. make uploadrun
  212. On unix:
  213. - The testing machine must be enabled to login on www.freepascal.org
  214. automatically as user fpc with ssh.
  215. On Windows:
  216. - The putty utilities plink.exe and pscp.exe must be in the path
  217. - There must be a putty session named [email protected] which is
  218. enabled to login automatically into www.freepascal.org
  219. Use TEST_USE_LONGLOG=1 as make parameter to pass information
  220. to server using longlog file instead of the whole output.