Wiki Example Administrators have write access to the [https://github.com/lorensen/VTKWikiExamples.git git repository]. Wiki Example Developers do not need write access to the repository since the definitive copy of the source code resides on the Wiki. If you are a Wiki Example User [[VTK/Examples/Instructions/ForUsers| go here]] or a Wiki Example Developer[[VTK/Examples/Instructions/ForDevelopers| go here]].
Wiki Example Administrators have write access to the [https://github.com/lorensen/VTKWikiExamples.git git repository]. If you are a Wiki Example User [go here](/Instructions/ForUsers) or a Wiki Example Developer[go here](/Instructions/ForDevelopers).
Wiki Example Administrators maintain the CMakeLists.txt files, example input files, example regression baseline files and synchronization scripts.
# Organization of the Example Repository
[TOC]
The wiki examples are stored in a [git repository](https://github.com/lorensen/VTKExamples.git) hosted at [github.com](http://www.github.com/). The repository contains several types of files.
#Organization of the Example Repository
# Administrator Tasks
The wiki examples are stored in a [https://github.com/lorensen/VTKWikiExamples.git git repository] hosted at [http://www.github.com/ github.com]. The repository contains several types of files:
* Top Level [https://github.com/lorensen/VTKWikiExamplesTarballs/raw/master/CMakeLists.txt ''CMakeLists.txt''] file
:This cmake file locates and includes the VTK_USE_FILE and adds directories for each of the topics
:[http://sourceforge.net/projects/mwclient/ mwclient] is a python framework to access MediaWiki's API. The ScrapeWiki script uses it to pull pages from the wiki and create example source files.
: This is a python script that uses [http://sourceforge.net/projects/mwclient/ mwclient] to access the pages of the wiki. It looks for pages in [[VTK/Examples|VTK/Examples]]. For each page, it looks for second level headings and stores the code that lies between <pre><source> and </source></pre> into a file in the proper topic subdirectory. Anyone, including users, can run this script. It updates the current directory with changes or new examples. If you run this script, be sure to re-run cmake.
: This is a python script that uses [http://sourceforge.net/projects/mwclient/ mwclient] to upload example baselines to the Wiki. The baselines are located in the Wiki git repository in [https://github.com/lorensen/VTKWikiExamples/tree/master/Testing/Baseline Testing/Baseline]. The script walks through the git baselines and checks to see if the baselines exist on the Wiki. If the baseline does not exist on the Wiki, the script uploads it. If the baseline does exist on the Wiki the [http://en.wikipedia.org/wiki/MD5 md5 hash] is checked to see if the image has changed.
: This is a python script that uses [http://sourceforge.net/projects/mwclient/ mwclient] to check each example to see if it should have a reference to a baseline image. If a baseline image exists for an example, the script looks for a <nowiki>''<div></div>''</nowiki> tag. This tag contains a reference for the baseline image for the example. If the tag is not found, the script generates a cut/paste line to edit the page as well as a cut/paste line that has the proper <nowiki>''<div></div>''</nowiki> for the baseline image.
: This shell script runs ''ScrapeWiki'' to create source files for all wiki examples. Then it uses git to add, remove or modify the source code. The resulting repository is pushed to [https://github.com/lorensen/VTKWikiExamples the github repository]. The script is run nightly by a cronjob on a designated host (currently BillsBasement).
!!! warning
this script should only be run by one individual (currently Lorensen)'''.
: Some examples require input data. A small number of datasets are distributed with the examples and are used by the regression tests. All administrators can add input data.
: Examples that produce images are regression tested. [http://www.cmake.org/Wiki/CMake_Testing_With_CTest ctest] runs the examples and when appropriate, compares the output of the example to a baseline image. Each topic has a directory in Testing/Baseline. All administrators can add and modify baseline images.
* Topic Directories
:Examples for each topic reside in a directory with the topic name. If the examples in a topic directory should be compiled and run, the topic directory has a CMakeLists.txt file. All administrators can create topic directories and CMakeLists.txt files.
By default, the ''CMakeLists.txt'' in a topic directory creates a small test driver for each .cxx file it finds. Then it creates an '''ADD_TEST''' command. The default '''ADD_TEST''' command assumes that the test has no arguments.
Some tests require arguments. To prevent the '''ADD_TEST''' from being generated, add any examples that require arguments to the list '''NEEDS_ARGS''':
Any example that uses a render window interactor will expect to find a baseline image for regression testing. The first time the test for the example is run, using ctest, the test will fail and report that a baseline image could not be found.
* The test for the example will produce a test output image in VTKWikiExamples-'''''build'''''/Testing/Temporary. The name of the image will be Test'''''ExampleName'''''.png
* With an image viewer, verify that the image is correct.
* Copy the image from Testing/Temporary into VTKWikiExamples/Testing/Baseline/'''''Topic'''''/Test'''ExampleName'''.png
* If there is more than one possible output image, name the image VTKWikiExamples/Testing/Baseline/'''''Topic'''''/Test'''ExampleName'''_1.png instead
We like to keep the example data to a small number of small files. If you must add input data for the tests:
git add Testing/Data/MyData.whatever
git commit -m "ENH: Added new example input data." Testing/Data/Mydata.whatever
git push
##Add a testing machine to the dashboard
* The simplest way is to add an Experimental build
make Experimental
* Or a Nightly build
make Nightly
* Or create a ctest script. A starting ctest script (SampleBuildTest.cmake) is created when you run cmake. You should edit this line so we know where the submissions is coming from:
<sourcelang="cmake">
set(CTEST_SITE "BillsBasement")
</source>
Then you should comment one of these, depending on which type of build you would like to submit.
<sourcelang="cmake">
set(DASHBOARD Nightly)
set(DASHBOARD Experimental)
</source>
----
:Copy the edited SampleBuildTest.cmake to '''''/home/foo/'''''WikiExamples.ctest. This can be run nightly from a cronjob (crontab -e)
If you notice that 'make' fails with a compiler error, you should attempt to fix the error in the source tree to ensure it works before copying the fix to the wiki. Once you change the source file, you will need to 'make rebuild_cache' so to re-create the Cxx/[directory]/CMakeFiles/IOCxxTests.dir/Test[ExampleName].cxx file that is actually built.