|
|
(2 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
− | How to do testing in Slicer3.
| + | <big>'''Note:''' We are migrating this content to the slicer.org domain - <font color="orange">The newer page is [https://www.slicer.org/wiki/Slicer3:Testing here]</font></big> |
− | | |
− | = Writing Tests =
| |
− | | |
− | == C++ ==
| |
− | | |
− | == Tcl ==
| |
− | | |
− | = Calling tests from CMake/CTest =
| |
− | | |
− | = Setting up automatic builds =
| |
− | | |
− | Note: this can also be used for continuous builds using the --test-type Continuous flag. | |
− | | |
− | == Windows ==
| |
− | | |
− | For windows you need to use the Add Scheduled Task option in the Control Panel to create the build. This task runs in a 'dumb' dos shell, so you need to help it get jump started. The following works:
| |
− | | |
− | * create a .bat file that that is called from the Scheduled Task
| |
− | * create a shell script that runs the build and call that from the .bat file
| |
− | | |
− | Here's an example for run.bat:
| |
− | | |
− | <pre> | |
− | echo off
| |
− | | |
− | C:
| |
− | chdir C:\cygwin\bin
| |
− | | |
− | set CYGWIN=binmode tty ntsec
| |
− | | |
− | rxvt -sl 1000 -e c:/pieper/run.csh -l
| |
− | </pre>
| |
− | | |
− | this example uses rxvt, which is available from cygwin, but not installed by default (it's an xterm ported to cygwin).
| |
− | | |
− | And here's an example run.csh:
| |
− | | |
− | <pre>
| |
− | #!/bin/csh
| |
− | | |
− | setenv PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem"
| |
− | | |
− | c:/pieper/bwh/slicer3/latest/Slicer3/Scripts/getbuildtest.tcl --update --test-type Nightly |& c:/cygwin/bin/tee c:/pieper/bwh/slicer3/latest/Slicer3.build-log
| |
− | | |
− | c:/cygwin/bin/sleep 5
| |
− | </pre>
| |
− | | |
− | == Unix ==
| |
− | | |
− | Here's an example script that can be dropped into /etc/cron.daily
| |
− | | |
− | <pre>
| |
− | #!/bin/tcsh
| |
− | | |
− | cd /home/pieper/slicer3/nightly
| |
− | rm -rf Slicer3 Slicer3-lib Slicer3-build
| |
− | | |
− | su - pieper -c "cd /home/pieper/slicer3/nightly; svn co http://www.na-mic.org/svn/Slicer3/trunk Slicer3 |& tee nightly.log"
| |
− | su - pieper -c "setenv DISPLAY :0; cd /home/pieper/slicer3/nightly; ./Slicer3/Scripts/getbuildtest.tcl -t Nightly |& tee -a nightly.log"
| |
− | | |
− | </pre>
| |
− | | |
− | Note: this assumes your shell is csh-like. If you use bash, replace the "|&" with "2>&1 |".
| |
− | | |
− | Note: the DISPLAY variable should be set to be the X display you want to run with. Most systems will have :0 as the default display.
| |
− | | |
− | Here's a similar example for a continuous build
| |
− | | |
− | <pre>
| |
− | #!/usr/bin/zsh
| |
− | | |
− | cd /playpen/davisb/Slicer3/continuous/Slicer3
| |
− | date > continuous.log
| |
− | export DISPLAY=:0
| |
− | ./Scripts/getbuildtest2.tcl --update --test-type Continuous |& tee -a continuous.log
| |
− | date >> continuous.log
| |
− | </pre> | |
− | | |
− | You can set up the script to be called every hour by adding this line to your cron file (crontab -e)
| |
− | | |
− | <pre>
| |
− | 0 * * * * /PathToTheScriptShownJustAbove/TestSlicer3Continuous.sh
| |
− | </pre> | |