3 #+TITLE: *foam-extend-3.2: A guide to test harness*
4 #+AUTHOR: Martin Beaudoin
5 #+DATE: 5 September 2015
6 #+LINK: foam-extend https://sourceforge.net/projects/openfoam-extend/
12 ###############################################################################
14 * A guide to the foam-extend test harness
15 This file is a guide to the foam-extend test harness.
17 The test harness from foam-extend version 3.2 was used as a reference
18 implementation for this documentation.
20 The original version of this file is located at
21 $WM\_PROJECT\_DIR/doc/testHarness/testHarness.org.
23 A plain text version of this file is located at
24 $WM\_PROJECT\_DIR/doc/testHarness/testHarness.txt.
26 A MediaWiki version of this file is located at
28 In case any converted versions (text, MediaWiki, etc.) of this file differ from
29 the original testHarness.org file, the latter should always be considered the
30 reference version. But we do appreciate your feedback and comments for improving
33 For instance, if you ever decide to improve the Mediawiki version only, please
34 consider contributing your changes back to the testHarness.org file as
35 well. Otherwise, your Mediawiki changes might get overwritten by an updated
36 version of the .org reference file.
39 The foam-extend test harness scripts are based mainly on Kitware CMake/CTest
40 utilities http://www.cmake.org/.
42 In its current version, the test harness is designed for running the full suite
43 of foam-extend tutorials, and report the fail/success results to a CDash Web
44 service one can consult using a simple browser.
46 The CDash Web service for foam-extend 3.2 is available here:
47 http://foam-extend.sourceforge.net/CDash/index.php
49 For a quick introduction of CMake/CTest, see here:
50 http://www.cmake.org/Wiki/CMake/Testing_With_CTest
52 For a more complete introduction to CMake and CTest, one can also refer to the
53 Kitware book `Mastering CMake: A Cross-Platform Build System`
54 http://www.kitware.com/products/books.php
56 For more information on Kitware CDash, see here: http://www.cdash.org/
58 The rest of this document will provide suficient information so you can run the
59 foam-extend test harness on your own.
61 ** Files location and a short description
62 The foam-extend test harness is currently built from the following files:
64 - =$WM_PROJECT_DIR/CMakeLists.txt= :: This is the main CMake file driving the
65 configuration of the test harness. When processed though the cmake
66 utility, all the necessary Makefiles and CTest scripts will get
69 - =$WM_PROJECT_DIR/CTestConfig.cmake= :: This file contains the various variables
70 and definitions necessary to publish your test harness results over the
71 CDash Web service for foam-extend 3.2.
73 - =$FOAM_SITE_DIR/etc/CTestConfig.site.cmake= :: This file allow you to override
74 the values from the main $WM\_PROJECT\_DIR/CTestConfig.cmake. This file
75 should be used if you are hosting your own site CDash Web
78 - =$WM_PROJECT_USER_DIR/etc/CTestConfig.user.cmake= :: This file allow you to
79 override the values from the main $WM\_PROJECT\_DIR/CTestConfig.cmake and the
80 site file $FOAM\_SITE\_DIR/etc/CTestConfig.site.cmake. This file should be
81 used if you are hosting your own user space personal CDash Web service.
83 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/CMakeFiles/CMakeLists.txt= ::
84 This file is a copy of the main $WM\_PROJECT\_DIR/CMakeLists.txt file.
86 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/CMakeFiles/CTestConfig.cmake.foam-extend= :: This file is a copy of the main $WM\_PROJECT\_DIR/CTestConfig.cmake file.
88 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/CMakeFiles/Dashboard_Tutorials.cmake.in= :: This file is a template for generating the file `ctest -S` file
89 $WM\_PROJECT\_DIR/testHarness/foam-extend/3.2/runDir/Dashboard\_Tutorials.cmake
90 CMake will take care of automatically generating the Dashboard\_Tutorials.cmake file.
92 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/CMakeFiles/FOAM_Tutorials.cmake= :: This file will configure a copy the foam-extend tutorials for running
93 under the test harness. The copy will be made under
94 $WM\_PROJECT\_DIR/testHarness/foam-extend/3.2/runDir.
96 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir/Allclean= :: Cleanup
97 script. Will remove all the automatically generated files and directories
98 for the test harness. Should be called prior to running the Allrun\_\* scripts.
100 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir/Allrun_CMakeOnly= :: This
101 script will generate all the necessary files for running the test harness
102 on the foam-extend tutorials. One can then invoke `make help` to see all
103 the available make options.
105 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir/Allrun_Experimental= ::
106 Same script as `Allrun\_CMakeOnly`, but will also call `make
109 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir/Allrun_Nightly= :: Same
110 script as `Allrun\_CMakeOnly`, but will also call `make Nightly`.
112 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/scripts/AdditionalRunFunctions= :: Additional `bash` macros for the tutorial Allrun files.
114 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/scripts/Allrun.default= ::
115 Default Allrun script for the tutorial when none are provided.
117 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/scripts/addMissingAllrunFileToTutorial.sh= :: Bash script for adding a default Allrun file to the tutorials that do not
118 have one. The test harness only run tutorials with an existing Allrun file
120 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/scripts/prepareCasesForOneTimeStep.sh= :: This script will modify the test cases system/controlDict in order for the
121 case to run for only 1 time step
123 - =$WM_PROJECT_DIR/testHarness/foam-extend/3.2/scripts/prepareCasesForTestHarness.sh= :: This script will modify the test cases Allrun file so it can run properly
124 under the test harness.
126 ** Configuring your $WM\_PROJECT\_DIR/etc/prefs.sh file for the test harness
127 The following environment variables are used for configuring the test
128 harness. You should use your $WM\_PROJECT\_DIR/etc/prefs.sh file to initialize
131 - =CDASH_SUBMIT_LOCAL_HOST_ID= :: System identifier for the FOAM CDash test harness
132 on foam-extend. By default, your system FQN/hostname will be used as the
133 system identifier when publishing your test harness results on the FOAM CDash
134 server on foam-extend. You can override your identifier using this environment
137 - =CDASH_SCM_INFO= :: Buildname suffix for the FOAM CDash test harness on foam-extend.
138 By default, the git branch name and git revision number will be appended to the CDash build name.
139 Otherwise, for users not using git, or wanting to provide additionnal
140 information, simply initialize the CDASH\_SCM\_INFO with the proper information.
142 - =WM_NCOMPPROCS= :: Specify the number of cores to use for the parallel execution
145 - =FOAM_TUTORIALS= :: Directory where the original test cases are located. For
146 foam-extend, this would be by default $WM\_PROJECT\_DIR/tutorials.
148 ** The main dashboards : Experimental, Nightly and Continuous
149 The result of a test run, reformatted for easy review, is called a
150 `dashboard`. A dashboard can be submitted to a central server, like CDash. Once
151 properly configured, the test harness will offer 3 main dashboards.
153 - =Experimental= :: Will test the current state of the project. An experimental
154 submission can be performed at any time, usually interactively from the
155 current working copy of a developer.
156 - =Nightly= :: Is similar to Experimental, except that the source tree will be set
157 to the state it was in at a specific nightly time. This ensures that all
158 `nightly` submissions correspond to the state of the project at the same
159 point in time. `Nightly` builds are usually done automatically at a preset
160 time of day. Nightly build will also update your source code to the latest
161 available revision. So it is best not to run a Nightly dashboard on source
162 code that is not yet committed.
163 - =Continuous= :: Means that the source tree is updated to the latest revision,
164 and a build / test cycle is performed only if any files were actually
165 updated. Like `Nightly` builds, `Continuous` ones are usually done
166 automatically and repeatedly in intervals.
168 There are also `intermediary dashboards` that allow you to select a specific
169 test harness intermediary step. The command `make help` will show you that list:
173 ... ContinuousConfigure
174 ... ContinuousCoverage
175 ... ContinuousMemCheck
180 ... ExperimentalBuild
181 ... ExperimentalConfigure
182 ... ExperimentalCoverage
183 ... ExperimentalMemCheck
184 ... ExperimentalStart
185 ... ExperimentalSubmit
187 ... ExperimentalUpdate
192 ... NightlyMemoryCheck
199 - Note :: For foam-extend, the MemCheck and Coverage dashboards are not supported.
201 ** Running the test harness
202 Running the test harness is pretty simple:
204 These commands will configure and run the `Experimental` version of the test harness:
207 cd $WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir
209 ./Allrun_Experimental
212 To run the `Nightly` version of the test harness:
215 cd $WM_PROJECT_DIR/testHarness/foam-extend/3.2/runDir
220 To see the full range of available options, run the command:
226 ** Selecting a subset of test cases to run
227 Instead of using the `make` command to run the test harness, one can also use
228 command `ctest`. The commmand `ctest` offers additionnal options to select or limit the number
231 The following command will provide all the available options for ctest:
237 Here is a list of useful ctest options:
239 - =ctest -N= :: this command will list the available tests by their name and
240 number. By default, all the tests are run in succession following the
241 numerical order shown.
243 - =ctest -R <regex>= :: run all the tests whose name are matching the supplied
244 regular expression. For instance, to run all the tests related to cfMesh,
245 one can use the following command: `ctest -R cfMesh`
247 - =ctest -E <regex>= :: run all the tests, but exclude the ones whose name is
248 matching the supplied regular expression. For instance, to run all the
249 tests except those for cfMesh, one can use the following command: `ctest -E
252 - =ctest -I [Start,End,Stride,test#,test#]= :: run individual tests by
253 number. `ctest -I 3,5` will run test 3, 4 and 5. `ctest -I 4,4,,4,7,13`
254 will run tests 4, 7 and 13.
256 - =ctest -D dashboard= :: run a specific dashboard test. For example, the command
257 `make Experimental` can be replaced by the following suite of ctest
260 ctest -D ExperimentalStart
261 ctest -D ExperimentalConfigure
262 ctest -D ExperimentalBuild
263 ctest -D ExperimentalTest
264 ctest -D ExperimentalSubmit
267 Here is a more complete example where we will configure, build, test and submit the test
268 harness results, but only for the incompressible tutorials:
270 ctest -D Experimental -R incompressible
274 ** Browsing the CDash service
276 The results of the test harness run will be published on the CDash dashboard on foam-extend.
279 URL : http://foam-extend.sourceforge.net/CDash/index.php?project=foam-extend-3.2
281 On this interactive Web site, one can then point and click various buttons
282 and menus to explore the various reports uploaded from your test harness runs.
284 ** Configuring the test harness for using your own site or personal CDash service
285 The foam-extend source code comes with a set pre-configured parameters for
286 uploading your dashboards results on the main project CDash server. One can also
287 choose to host their own CDash service, either as a site service, or as a
288 personnal service running in your own user space. Your CDash administrator can
289 generate a file similar to $WM\_PROJECT\_DIR/CTestConfig.cmake where all the
290 necessary parameters for connecting to your local service are specified.
292 In order to use your site CDash service, simply copy your site CTestConfig.cmake
293 file to $FOAM\_SITE\_DIR/etc/CTestConfig.site.cmake
295 In order to use your personnal CDash service, simply copy your personnal CTestConfig.cmake
296 file to $WM\_PROJECT\_USER\_DIR/etc/CTestConfig.user.cmake
298 As usual, your site configuration will override the default parameters from the
299 main configuration file $WM\_PROJECT\_DIR/CTestConfig.cmake.
301 Likewise, your personnal configuration will override the default parameters from the
302 main configuration file $WM\_PROJECT\_DIR/CTestConfig.cmake and the default
303 parameters from the site file $FOAM\_SITE\_DIR/etc/CTestConfig.site.cmake.
306 ** New features for the test harness (foam-extend 3.2):
307 - =Running the test harness in parallel= :: It is now possible to run the test
308 harness in parallel over a single node or computer. The environment
309 variable WM\_NCOMPPROCS will specify the number of cores to use for
310 running the test harness. For `n` cores specified, `n` tutorials will
311 be running in parallel on your computer. Since all the tests will
312 still run on the same computer, make sure you have enough ressources to
313 run `n` tutorials in parallel. Depending on the number of cores
314 available, one might have to tweak some of the shell `limits`
315 values. The command `ulimit -a` will show you the actual limits values
316 imposed on your shell. Some limit values like `open files` (ulimit -n)
317 or `max user processes` (ulimit -u) might need to be adjusted to some
318 higher values. In doubt, consult with your local sysadmin.
321 The MediaWiki version of this file was generated using the following command:
324 pandoc testHarness.org -s -S -f org -t mediawiki -o testHarness.mediawiki
327 The ASCII version of this file was generated using the following command:
330 pandoc testHarness.org -N -s -S -f org -t asciidoc -o testHarness.txt