tests-readme.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. Welcome to the Irrlicht test suite.
  2. ===================================
  3. This is composed of a series of tests which exercise basic Irrlicht
  4. functionality. These are not strictly unit tests, since there is no stub
  5. framework that isolates each method under test. They do however test small
  6. units of functionality and should help to isolate problems and spot
  7. regressions.
  8. You are encouraged to run the tests whenever you make any significant code
  9. change, and to add tests for any new or modified area of code.
  10. The overall test application will return a count of the number of tests that
  11. failed, i.e. 0 is success. It will also log to tests/tests.log file, and on
  12. success will update the tests/tests-last-passed-at.txt file (which gets
  13. committed with code changes as a very basic verification that we're not
  14. regressing).
  15. Working directory
  16. =================
  17. Since the tests rely on the presence of /media and /empty/empty subdirectories,
  18. the working directory must be the /tests directory, not /bin/$PLATFORM. This
  19. means that you cannot run /bin/$PLATFORM/texts.exe from there. You can however
  20. cd to /tests and run ../bin/$PLATFORM/tests.exe
  21. Adding a new test
  22. =================
  23. To add a new test, e.g. "myNewTest":
  24. 1) Create tests/myNewTest.cpp. At a minimum, this must contain a function with
  25. the signature bool fnName(void), where fnName is the same as the filename
  26. (without the .cpp suffix).
  27. This function must return true if the tests passes, or false if it fails. In
  28. this example, the function should be:
  29. bool myNewTest(void)
  30. {
  31. ...
  32. }
  33. 2) Add myNewTest.cpp to the build targets in tests.cbp, tests_vc8.vcproj and
  34. tests_vc9.vcproj. These are all text files that can be edited manually by
  35. hand; just copy, paste and modify an existing source file entry.
  36. 3) In tests/main.cpp, find the list of TEST() macro calls, and add a call to
  37. your new test, using the TEST macro, e.g.:
  38. TEST(myNewTest);
  39. 4) Run your test, and verify any images that it produces (see "Screenshots").
  40. 5) Remember to svn add tests/newNewTest.cpp and any new tests/media/ files.
  41. Your test will be run independently in its own indepedent process. It is
  42. responsible for creating any required resources or Irrlicht interfaces, and for
  43. cleaning up after itself and restoring the working directory to /tests. You do
  44. not have to link against Irrlicht.lib; the whole application is already linked
  45. to it.
  46. Logging
  47. =======
  48. Please use logTestString() to log any interesting output or fails from your
  49. test. This is declared in tests/testUtils.h. Its output goes to
  50. tests/tests.log
  51. Screenshots
  52. ===========
  53. testUtils.h/.cpp provides a function to create a screenshot and compare it with
  54. a reference image. This is useful for validating new or changed functionality,
  55. and for catching regressions.
  56. Call the unambiguously named takeScreenshotAndCompareAgainstReference()
  57. function to do this. It needs an IVideoDriver (which it will use to create the
  58. first part of the filename) and a unique filename including an image format
  59. suffix, e.g. "-myNewTest.png". You should use .png as a suffix unless you have
  60. a very specific need to use another format. Please avoid using .jpg as image
  61. compression can introduce artifacts and false fails.
  62. Optionally, you can specify the amount of match that is required between the
  63. produced screenshot and the reference image. While the images should match
  64. exactly, we have found that OpenGL implementations can vary significantly
  65. across test machines, often around 99% match (of total colour values across all
  66. pixels). You may have to go as low as 98% for some images, but please try to
  67. err on the side of strictness until we can determine that your test image needs
  68. to be fuzzier on other peoples' machines.
  69. If takeScreenshotAndCompareAgainstReference() can't find an existing reference
  70. image, it will create one from the screenshot. In effect, this means that you
  71. have to run your test once (expecting it to fail) in order to produce the
  72. initial reference images. The new images are created in tests/results with
  73. filename:
  74. driverName-filename.suffix
  75. e.g. OpenGL-myNewTest.png (note that the OpenGL driver elides the actual OpenGL
  76. version number from the filename, as this tends to differ between machines and
  77. installations).
  78. You should check these new images carefully to ensure that they show exactly
  79. what you expect. Please do not just assume that they do, as validating bad
  80. behaviour is worse than not validating it at all!
  81. If the images do appear exactly as you expect, move them to the tests/media
  82. directory, and re-run the tests. They should now pass. Remember to svn add
  83. any new media files!
  84. What to do when the tests fail
  85. ==============================
  86. DON'T PANIC!
  87. This is a Good Thing. Failing tests challenge our assumptions and help us to
  88. make Irrlicht more robust.
  89. First, check your working directory. The tests need to be run from the tests/
  90. directory, not a /bin subdirectory. You can do this using the working
  91. directory in your debugger, or on the command line by running the tests
  92. executable (wherever it is build) from the tests/ directory.
  93. If you need to debug a test, first move it temporarily to the start of the list
  94. of TEST() macros. This is because each test runs in its own process, so only
  95. the first test will have the debugger attached.
  96. If the fail is due to a bitmap difference, carefully compare the bitmaps, and
  97. the amount of failure. The OpenGL device does tend to produce differences. You
  98. should not just automatically make a test fuzzier, but if you can rule out any
  99. real issue in the code, it can be valid to accept OpenGL image matches as low
  100. as 98%. Other devices should not require this amount of fuzziness!
  101. If you can't figure out the reason for the failure (or better yet, if you can,
  102. and think the tests and/or Irrlicht need updated), then please do raise the
  103. issue in the bug forum:
  104. http://irrlicht.sourceforge.net/phpBB2/viewforum.php?f=7
  105. We do want to hear about fails, and will thank you for finding them.
  106. Running specific tests
  107. ======================
  108. The app takes two parameters. First is the test to start with (starting at 0
  109. anddefaulting to 0), the second is the number of tests to run (beginning with
  110. the one given as first parameter). If the second parameter is not given, all
  111. existing tests are run (again starting with the first parameter). So, starting
  112. the test suite without a parameter will really run all tests. Another special
  113. parameter is '--list', which outputs a list of all existing tests and their
  114. respective number.
  115. For debugging purposes it can make sense to run a test without spawning a
  116. separate process for each test case. This can be switched off by a boolean flag
  117. in main.cpp ('spawn=false').
  118. Currently implemented tests
  119. ===========================
  120. 000. disambiguateTextures
  121. 001. testIrrArray
  122. 002. testIrrMap
  123. 003. testIrrList
  124. 004. exports
  125. 005. irrCoreEquals
  126. 006. testIrrString
  127. 007. testLine2d
  128. 008. matrixOps
  129. 009. testDimension2d
  130. 010. testVector2d
  131. 011. testVector3d
  132. 012. testQuaternion
  133. 013. testS3DVertex
  134. 014. testaabbox3d
  135. 015. color
  136. 016. testTriangle3d
  137. 017. vectorPositionDimension2d
  138. 018. filesystem
  139. 019. archiveReader
  140. 020. testXML
  141. 021. serializeAttributes
  142. 022. fast_atof
  143. 023. loadTextures
  144. 024. collisionResponseAnimator
  145. 025. enumerateImageManipulators
  146. 026. removeCustomAnimator
  147. 027. sceneCollisionManager
  148. 028. sceneNodeAnimator
  149. 029. meshLoaders
  150. 030. testTimer
  151. 031. softwareDevice
  152. 032. b3dAnimation
  153. 033. burningsVideo
  154. 034. billboards
  155. 035. createImage
  156. 036. cursorSetVisible
  157. 037. flyCircleAnimator
  158. 038. guiDisabledMenu
  159. 039. makeColorKeyTexture
  160. 040. md2Animation
  161. 041. meshTransform
  162. 042. skinnedMesh
  163. 043. testGeometryCreator
  164. 044. writeImageToFile
  165. 045. ioScene
  166. 046. videoDriver
  167. 047. screenshot
  168. 048. drawPixel
  169. 049. drawRectOutline
  170. 050. drawVertexPrimitive
  171. 051. material
  172. 052. renderTargetTexture
  173. 053. textureFeatures
  174. 054. textureRenderStates
  175. 055. transparentMaterials
  176. 056. userclipplane
  177. 057. antiAliasing
  178. 058. draw2DImage
  179. 059. lights
  180. 060. twodmaterial
  181. 061. viewPort
  182. 062. mrt
  183. 063. projectionMatrix
  184. 064. planeMatrix
  185. 065. terrainSceneNode
  186. 066. lightMaps
  187. 067. triangleSelector