README 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. This directory contains a suite of tests targetting the parser. Right now, the
  2. main test is the "kitchen sink" test, which attempts to exercise every
  3. non-terminal in the parser, to the degree that this is possible. According to
  4. gcov, it achieves a reasonable degree of success. Gradually, I'll add tests
  5. that cover the rest of the parser -- mostly error conditions, but generally
  6. constructs which are incompatible in some way with constructs in the kitchen
  7. sink test.
  8. The primary interface to these tests is through the test_parser.py script:
  9. 1) the test scripts (and the instructions below) assume you are in the
  10. mdl/testsuite/parser. This will not be necessary in the nearby future,
  11. but for now...
  12. 2) create a test.cfg file with the path to the MCell executable you want to
  13. test:
  14. [DEFAULT]
  15. mcellpath = /home/jed/src/mcell/3.1-pristine/build/debug/mcell
  16. otherwise, it should assume you mean the mcell in your path.
  17. 3) Presently, you'll need to set your PYTHONPATH. I've included a script to
  18. help with this. This will, shortly, become unnecessary, but in the
  19. meantime, it should allow others to get in on the testing excitement. For
  20. sh/bash/zsh/ksh users, run:
  21. . set_python_path.sh
  22. and for csh/tcsh users, run:
  23. . set_python_path.csh
  24. (Note, I've only tested the former, and you must be in the parser
  25. directory for this to "do the right thing".) Essentially, you want your
  26. PYTHONPATH environment variable to point to testsuite/system_tests in the
  27. source tree, so if you'd rather set the environment variable yourself, you
  28. can.
  29. 4) Run test_parser.py. If python is in your path, the simplest invocation
  30. is:
  31. ./test_parser.py
  32. which will run the complete parser test suite (currently something like
  33. 110 tests, taking on the order of 5-10 minutes to run). There are
  34. specific subsets of the parser test you can invoke:
  35. ./test_parser.py fullsuite # all tests (same as default invocation)
  36. ./test_parser.py quicksuite # a quickly running subset of all tests
  37. ./test_parser.py errorsuite # all parser error handling tests
  38. ./test_parser.py kitchensinksuite # tests of all major features except VIZ output
  39. ./test_parser.py allvizsuite # all tests of VIZ modes
  40. ./test_parser.py vizsuite # all tests of DREAMM v3 VIZ modes
  41. ./test_parser.py oldvizsuite # all tests of non-DREAMM VIZ modes (DX, ASCII, RK)
  42. ./test_parser.py rtcheckpointsuite # all tests of realtime checkpoint parsing
  43. rtcheckpointsuite will take around 4 minutes to run, as each run schedules
  44. a checkpoint for approx. 30 seconds into the run, and then the timing of
  45. the checkpointing and exiting is tested. Note that this also means that
  46. when run on a very heavily loaded machine, these tests could falsely
  47. report failure. The setup of the simulation, however, I think makes it
  48. unlikely to occur in practice.
  49. It's possible to run individual tests in the test suite as well, though
  50. this is a more advanced usage, probably outside the scope of this
  51. document.
  52. I recommend redirecting the output to a file either using the shell
  53. redirection operator '>', or using 'tee', as:
  54. ./test_parser.py | tee testlog
  55. since it's useful to save the output when an error occurs.
  56. You'll see one dot (.) for every test that passes, an F for every test
  57. that fails, and an E for every error that occurs while trying to set up
  58. the test. 'E' means that something went wrong in the test script, whereas
  59. F means that a failure condition was detected while running the
  60. executable.
  61. Note that the test will also occasionally print out messages that look like:
  62. Warning: Gaussian value outside of 95% confidence interval.
  63. Expected to occur occasionally.
  64. Value: 0.290164271582879 (mean=0, stdev=0.125)
  65. They are part of the expression evaluation tests, which, aside from
  66. analyzing all of the deterministic output, also examine the means of 64
  67. uniform random numbers and of 64 Gaussian random numbers, checking the
  68. means against approximate 95% confidence intervals. Once in a while, we
  69. should see these warning messages.
  70. The tests have been updated to include valid 95% confidence intervals.
  71. I'm using the 2 standard deviations rule of thumb, which is slightly
  72. generous. We have two tests per kitchen-sink-style test, one for uniform
  73. numbers and one for gaussian. The kitchen sink suite includes 8
  74. kitchen-sink-style tests, and the viz output suite includes another 13.
  75. So, on a run of the kitchen sink suite, you'd expect to see each message
  76. about confidence intervals about 40% of the time, and for a run of the
  77. full parser suite, you'd expect to see a message about each confidence
  78. interval about once.
  79. If you see these message far more or less often than this rule-of-thumb
  80. predicts, then something may have gotten jarred loose in the random number
  81. generators.
  82. 5) Files created by the various tests will be created under individual
  83. subdirectories under test_results. stdout/stderr are saved in the files
  84. stdout/stderr, but all output should have been redirected to
  85. realout/realerr in the same directory, which are the log_file and
  86. err_file, resp. from MCell. The complete command-line is available in
  87. cmdline.txt. All count/vol/viz output files should be under the directory
  88. for the execution that produced them.
  89. *****************
  90. NOTE: These directories are mercilessly destroyed when the test suite is
  91. run, so don't put anything you care about under test_results, and if you
  92. want to examine/keep files produced from a run of the test suite, be sure
  93. to do so before you run the test suite again.
  94. *****************
  95. * Test 01: Nearly every parser option.
  96. * Test 02: Realtime checkpoint variants.
  97. * invalid-*: Test error conditions.
  98. Currently, the parser error conditions we test are:
  99. General errors:
  100. * invalid-001: Point is not 3D (4D point specified)
  101. * invalid-002: Point is not 3D (2D point specified)
  102. * invalid-003: Point is not 3D (1D point specified)
  103. * invalid-004: Orient doesn't fit in short integer (40000)
  104. * invalid-005: Orient doesn't fit in short integer (-40000)
  105. * invalid-006: Orient doesn't fit in short integer (32768)
  106. * invalid-007: Orient doesn't fit in short integer (32970 commas)
  107. * invalid-008: Orient doesn't fit in short integer (32970 apostrophes)
  108. * invalid-009: Range error - log [zero]
  109. * invalid-010: Range error - log [negative]
  110. * invalid-011: Range error - exp [overflow]
  111. * invalid-012: Range error - log10 [zero]
  112. * invalid-013: Range error - log10 [negative]
  113. * invalid-014: Range error - sqrt [negative]
  114. * invalid-015: Range error - asin(2)
  115. * invalid-016: Range error - acos(-2)
  116. * invalid-017: Range error - MOD(20.0, 0.0)
  117. * invalid-018: Range error - 20 / 0
  118. * invalid-019: Range error - 20 ^ 1e100
  119. * invalid-020: Range error - 1e300*1e300*1e300*1e300
  120. * invalid-049: Includes nested too deeply.
  121. * invalid-050: Include file not found.
  122. I/O subsystem errors:
  123. * invalid-021: fopen fails (file doesn't exist)
  124. * invalid-022: fopen fails (can't open in read mode)
  125. * invalid-023: fopen fails (file is a directory)
  126. * // Should add: fopen fails (permission denied)
  127. // But be careful -- using a known unwritable file could be disastrous if
  128. // anyone ever ran the test suite as root...
  129. * invalid-025: fclose fails (closed twice)
  130. * invalid-026: fclose fails (no such file)
  131. Checkpoint-related errors:
  132. * invalid-027: CHECKPOINT_ITERATIONS out of range
  133. * // Should discuss 0 as a value for CHECKPOINT_ITERATIONS.
  134. // Might be legitimate reasons for specifying 0 (for instance, to disable
  135. // iteration-based checkpointing via a variable setting. Should either test
  136. // for failure when CHECKPOINT_ITERATIONS == 0, or should test for correct
  137. // behavior.
  138. * invalid-029: CHECKPOINT_REALTIME multiply specified
  139. * invalid-030: CHECKPOINT_REALTIME interval is negative
  140. Errors in time/space step:
  141. * invalid-031: TIME_STEP == 0
  142. * invalid-032: TIME_STEP < 0
  143. * invalid-033: SPACE_STEP == 0
  144. * invalid-034: SPACE_STEP < 0
  145. * invalid-035: CUSTOM_TIME_STEP < 0 *** not presently treated as an error
  146. * invalid-036: CUSTOM_TIME_STEP == 0 *** not presently treated as an error
  147. * invalid-037: CUSTOM_SPACE_STEP < 0 *** not presently treated as an error
  148. * invalid-038: CUSTOM_SPACE_STEP == 0 *** not presently treated as an error
  149. * invalid-039: TIME_STEP multiply specified
  150. * invalid-040: SPACE_STEP multiply specified
  151. * invalid-041: TIME_STEP not specified
  152. Errors in surface initialization:
  153. * invalid-042: Initialize effector with surface
  154. * invalid-043: Initialize effector with volume molecule
  155. Errors in reactions:
  156. * invalid-044: Reaction omits forward rate.
  157. * invalid-045: Reaction omits reverse rate.
  158. * invalid-046: Reaction has two reverse rates
  159. * invalid-047: Reaction has two forward rates
  160. * invalid-048: Reaction rate is an array variable
  161. Errors in release sites:
  162. * invalid-051: Set density or number for list release site.
  163. * invalid-052: Set molecule positions for non-list release site.
  164. * invalid-053: Site radius/diameter not a number or a 3-vector.
  165. * invalid-054: Site radius/diameter an incorrectly sized vector
  166. * invalid-055: Concentration specified on spherical shell.
  167. Errors in geometry:
  168. * invalid-056: Polygon created with more than 3 vertices.
  169. * invalid-057: Polygon created with fewer than 3 vertices.
  170. * invalid-058: Voxel created with more than 4 vertices.
  171. * invalid-059: Voxel created with fewer than 4 vertices.
  172. * invalid-062: Attempt to set aspect ratio < 2.0
  173. * invalid-084: Attempt to create a patch on a non-BOX object.
  174. * invalid-085: Attempt to create a patch on an already triangulated BOX object.
  175. Errors in regions:
  176. * invalid-060: Reference to side by name in polygon
  177. * invalid-061: Use of PATCH on a polygon
  178. * invalid-063: Attempt to define a region on a non-polygonal object.
  179. * invalid-064: Out-of-range element specifiers
  180. * invalid-065: Element specifier bounds reversed.
  181. Errors in reaction data output:
  182. * invalid-028: Output timing omitted
  183. * invalid-066: Count buffer specified < 1
  184. * invalid-067: Count buffer specified > UINT_MAX
  185. * invalid-068: TRIGGER and COUNT in the same statement
  186. * invalid-069: Column header with wildcard expansion
  187. Errors in VIZ output:
  188. * invalid-070: VIZ_OUPUT block omits FILENAME option in DREAMM mode
  189. * invalid-071: multiple VIZ output modes in one file
  190. * invalid-072: new style molecules-spec with non-DX and non-DREAMM output
  191. * invalid-073: multiple CUSTOM_RK output blocks in one file
  192. * invalid-074: both binary and ascii mesh format specifiedpppp
  193. * invalid-075: both binary and ascii molecule format specifiedpppp
  194. * invalid-076: VIZ_MOLECULE_FORMAT specified outside of DREAMM mode
  195. * invalid-077: VIZ_MESH_FORMAT specified outside of DREAMM mode
  196. * invalid-078: DX-mode name list contains molecules without state values
  197. * invalid-079: DX-mode name list contains meshes without state values
  198. * invalid-080: DX-mode name list contains ALL_MESHES
  199. * invalid-081: DX-mode name list contains ALL_MOLECULES
  200. * invalid-082: In DREAMM mode, MOLECULE_FILE_PREFIX specified
  201. * invalid-083: In DREAMM mode, OBJECT_FILE_PREFIXES specified