diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-03 10:30:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-03 10:30:09 (GMT) |
commit | 8124991ded20a7b2f36a056dc701d138573561fc (patch) | |
tree | 541bd2fd0894ac665eba8f708c99bfe741edca3c /contrib/ctest | |
parent | f627a8a8b139a42568f67dc18679d92806e0ff4e (diff) | |
download | uscxml-8124991ded20a7b2f36a056dc701d138573561fc.zip uscxml-8124991ded20a7b2f36a056dc701d138573561fc.tar.gz uscxml-8124991ded20a7b2f36a056dc701d138573561fc.tar.bz2 |
Setup ctest for the swedish owl
Diffstat (limited to 'contrib/ctest')
-rw-r--r-- | contrib/ctest/README.md | 91 | ||||
-rw-r--r-- | contrib/ctest/common.ctest.inc | 108 | ||||
-rw-r--r-- | contrib/ctest/hosts/buildslave-centos-5-32.ctest | 7 | ||||
-rw-r--r-- | contrib/ctest/hosts/buildslave-centos-6-64.ctest | 7 | ||||
-rw-r--r-- | contrib/ctest/hosts/buildslave-fedora-16-64.ctest | 7 | ||||
-rw-r--r-- | contrib/ctest/hosts/buildslave-opensuse-12-32.ctest | 7 | ||||
-rw-r--r-- | contrib/ctest/hosts/buildslave-ubuntu-1204-32.ctest | 7 | ||||
l--------- | contrib/ctest/hosts/dhcp1.alkit.se.ctest | 1 | ||||
-rw-r--r-- | contrib/ctest/hosts/epikur.local.ctest | 7 | ||||
-rwxr-xr-x | contrib/ctest/run-tests.cron | 79 | ||||
-rw-r--r-- | contrib/ctest/run-tests.vbs | 83 | ||||
-rw-r--r-- | contrib/ctest/tests/generic.ctest | 1 |
12 files changed, 405 insertions, 0 deletions
diff --git a/contrib/ctest/README.md b/contrib/ctest/README.md new file mode 100644 index 0000000..1815bdc --- /dev/null +++ b/contrib/ctest/README.md @@ -0,0 +1,91 @@ +# Setting up CTest Slaves + +If you want to contribute a test-slave, just create a file called +<tt>hosts/<HOSTNAME>.ctest</tt> - have a look at the existing host files. +Then setup your crontab as follows: + + 50 */4 * * * CTEST_SUBMIT_TYPE="Experimental" /home/autobuilder/uscxml/contrib/ctest/run-tests.cron + 0 2 * * * CTEST_SUBMIT_TYPE="Nightly" /home/autobuilder/uscxml/contrib/ctest/run-tests.cron + */2 * * * * CTEST_SUBMIT_TYPE="Continuous" /home/autobuilder/uscxml/contrib/ctest/run-tests.cron + +<b>Note:</b> Be aware that <tt>run-tests.cron</tt> is under version control and +might get updated from git with potentially surprising content. Copy the whole +ctest directory someplace safe if you are concerned and make sure to specify +<tt>USCXML_SOURCE_DIR=/uscxml/checkout/here</tt> in the crontab line. + +<b>Note:</b> We will build in <tt>/tmp</tt>, make sure there is enough room for all three +build directories. + +<b>Warning:</b> <tt>run-tests.cron</tt> will pull the current GIT head. Use a +dedicated source checkout for testing if this is a problem. + +# How it works + +<tt>run-tests.cron</tt> will setup the environment to call your host-specific +test file with <tt>ctest</tt>. If you do not provide a value for +<tt>USCXML_SOURCE_DIR</tt> it will assume that you want to work with the source +containing the script itself. + +When your host-specific test file is called, you can assume the following facts: + +* You are the only running ctest instance invoked by <tt>run-tests.cron</tt> +* There is a path to the ctest executable in <tt>$ENV{CTEST}</tt> +* The current working directory is the ctest directory. +* The chosen submit type is available as <tt>$ENV{CTEST_SUBMIT_TYPE}</tt> +* The path to the umundo sources is available as <tt>$ENV{UMUNDO_SOURCE_DIR}</tt> + +As a host-specific test file, you are expected to prepare test-builds by setting +the following variables and call <tt>include("common.ctest.inc")</tt> for every +build you prepared. + +<table> + <tr><th>Variable</th><th>Comment</th></tr> + <tr> + <td><tt>CTEST_SITE</tt></td> + <td>The name of this build-slave for reporting in the dashboard. Should be the same for all submitted test-builds</td> + </tr> + <tr> + <td><tt>CTEST_CMAKE_GENERATOR</tt></td> + <td>The generator to use with cmake (e.g. "Unix Makefiles")</td> + </tr> + <tr> + <td><tt>CTEST_BUILD_CONFIGURATION</tt></td> + <td>"Debug", "Release" ..</td> + </tr> + <tr> + <td><tt>CTEST_TOOLCHAIN</tt></td> + <td>Path to a cmake toolchain file for cross compiling.</td> + </tr> + <tr> + <td><tt>CTEST_BUILD_NAME</tt></td> + <td>Name of the particular build you are about to submit (e.g. "darwin-x86_64 llvm bonjour").</td> + </tr> + <tr> + <td><tt>CTEST_BUILD_OPTIONS</tt></td> + <td>Parameters to be passed to cmake when preparing the build. These will + most likely come from one of the tests/*.ctest files.</td> + </tr> +</table> + +## Example from the centos6x64-vii build-slave: + + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + set(CTEST_SITE "centos6x64-vii") + set(CTEST_BUILD_CONFIGURATION "Debug") + + # test with avahi + include("tests/avahi.ctest") + set(CTEST_BUILD_NAME "linux-x86_64 gcc avahi") + include("common.ctest.inc") + + # test for embedded bonjour + include("tests/bonjourEmbedded.ctest") + set(CTEST_BUILD_NAME "linux-x86_64 gcc bonjour embedded") + include("common.ctest.inc") + + # test android cross-compile with embedded bonjour + include("tests/bonjourEmbedded.ctest") + set(CTEST_BUILD_NAME "linux-x86_64-android gcc bonjour embedded") + set(CTEST_TOOLCHAIN "$ENV{UMUNDO_SOURCE_DIR}/contrib/cmake/CrossCompile-Android.cmake") + include("common.ctest.inc") + diff --git a/contrib/ctest/common.ctest.inc b/contrib/ctest/common.ctest.inc new file mode 100644 index 0000000..ec0813e --- /dev/null +++ b/contrib/ctest/common.ctest.inc @@ -0,0 +1,108 @@ +# +# This file gets called from the host-specific test files in hosts/. They are +# expected to set the following CTest variables: +# +# CTEST_CMAKE_GENERATOR - the generator to use for cmake (e.g. "Unix Makefiles") +# CTEST_SITE - the name of this build-slave +# CTEST_BUILD_CONFIGURATION - "Debug", "Release" .. +# CTEST_BUILD_NAME - name of the particular build (e.g. "darwin-x86_64 llvm bonjour") +# CMAKE_TOOLCHAIN_FILE - name of a toolchain file for cross-compiling +# +# CTEST_BUILD_OPTIONS - parameters to be passed to cmake when preparing the build +# these will most likely come from one of the tests/*.ctest files +# +# In addition, we expect the following environment variables to be set: +# +# CTEST_SUBMIT_TYPE - "Experimental", "Nightly", "Continuous" +# USCXML_SOURCE_DIR - full path to the uscxml sources we will work with +# +# We will always build in /tmp/build-* +# + +if ("$ENV{CTEST_SUBMIT_TYPE}" STREQUAL "") + message(FATAL_ERROR "ENV{CTEST_SUBMIT_TYPE} is emtpy") +endif() + +if ("$ENV{USCXML_SOURCE_DIR}" STREQUAL "") + message(FATAL_ERROR "ENV{USCXML_SOURCE_DIR} is emtpy") +endif() + +set(CTEST_SOURCE_DIRECTORY $ENV{USCXML_SOURCE_DIR}) +set(CTEST_SUBMIT_TYPE $ENV{CTEST_SUBMIT_TYPE}) +set(CTEST_BINARY_DIRECTORY "/tmp/build-${CTEST_SUBMIT_TYPE}-${CTEST_SCRIPT_NAME}") + +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576) +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1048576) + +### Coverage and Memory checks? (untested) ################################ + +#set(WITH_COVERAGE TRUE) +#find_program(CTEST_COVERAGE_COMMAND NAMES gcov) + +#set(WITH_MEMCHECK TRUE) +#find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) +#set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CTEST_SOURCE_DIRECTORY}/tests/valgrind.supp) + +### Versioning Control ################################################### + +find_program(CTEST_GIT_COMMAND NAMES git) +if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone git://github.com/tklab-tud/uscxml.git ${CTEST_SOURCE_DIRECTORY}") +endif() + +set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") + +### CMake Command line ################################################### + +set(CTEST_CONFIGURE_COMMAND "${CMAKE_COMMAND} -LA -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}") +set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"-G${CTEST_CMAKE_GENERATOR}\"") + +if (CTEST_TOOLCHAIN) + set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} -DCMAKE_TOOLCHAIN_FILE=${CTEST_TOOLCHAIN} ${CTEST_BUILD_OPTIONS}") +else() + set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} ${CTEST_BUILD_OPTIONS}") + #set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} -DBUILD_TESTS=ON ${CTEST_BUILD_OPTIONS}") +endif() + +set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"${CTEST_SOURCE_DIRECTORY}\"") + +#message(FATAL_ERROR "CTEST_CONFIGURE_COMMAND: ${CTEST_CONFIGURE_COMMAND}") + +### Test! ################################################################ + +# clean build directory +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +ctest_start(${CTEST_SUBMIT_TYPE}) # start testing +# +# I accidentally resynced when running from IDE thrice! +# We will rely on the run_tests.cron script to update to head +# +#ctest_update() # synchronize with git head + +ctest_configure() # run cmake + +if (CTEST_TOOLCHAIN) +# +# We do not want to build the tests everytime we compile something, but we cannot +# add a dependency to target "test" as it is unknown to CMake, instead, we introduce +# a new target "ctest" for all tests to depend upon. +# +# But when cross-compiling, we do not add any tests, that is "ctest" depends on nothing, +# in this case, build the whole library without tests. +# + set(CTEST_BUILD_TARGET "") +else() + set(CTEST_BUILD_TARGET "") +endif() +ctest_build() # build custom target that depends on all the actual tests +ctest_test() # run tests + +if (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND) + ctest_coverage() +endif (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND) +if (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND) + ctest_memcheck() +endif (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND) + +ctest_submit() # submit diff --git a/contrib/ctest/hosts/buildslave-centos-5-32.ctest b/contrib/ctest/hosts/buildslave-centos-5-32.ctest new file mode 100644 index 0000000..eccb743 --- /dev/null +++ b/contrib/ctest/hosts/buildslave-centos-5-32.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "buildslave-centos-5-32") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "linux-x86_64 gcc 4.1.2") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/hosts/buildslave-centos-6-64.ctest b/contrib/ctest/hosts/buildslave-centos-6-64.ctest new file mode 100644 index 0000000..3eeca79 --- /dev/null +++ b/contrib/ctest/hosts/buildslave-centos-6-64.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "buildslave-centos-6-64") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "linux-x86_64 gcc 4.4.6") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/hosts/buildslave-fedora-16-64.ctest b/contrib/ctest/hosts/buildslave-fedora-16-64.ctest new file mode 100644 index 0000000..605ee8d --- /dev/null +++ b/contrib/ctest/hosts/buildslave-fedora-16-64.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "buildslave-fedora-16-64") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "linux-x86_64 gcc 4.6.3") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/hosts/buildslave-opensuse-12-32.ctest b/contrib/ctest/hosts/buildslave-opensuse-12-32.ctest new file mode 100644 index 0000000..a1c6cdb --- /dev/null +++ b/contrib/ctest/hosts/buildslave-opensuse-12-32.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "buildslave-opensuse-12-32") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "linux-x86 gcc 4.7.2") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/hosts/buildslave-ubuntu-1204-32.ctest b/contrib/ctest/hosts/buildslave-ubuntu-1204-32.ctest new file mode 100644 index 0000000..7d16ecd --- /dev/null +++ b/contrib/ctest/hosts/buildslave-ubuntu-1204-32.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "buildslave-ubuntu-1204-32") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "linux-x86 gcc 4.6.3") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/hosts/dhcp1.alkit.se.ctest b/contrib/ctest/hosts/dhcp1.alkit.se.ctest new file mode 120000 index 0000000..0116ab8 --- /dev/null +++ b/contrib/ctest/hosts/dhcp1.alkit.se.ctest @@ -0,0 +1 @@ +epikur.local.ctest
\ No newline at end of file diff --git a/contrib/ctest/hosts/epikur.local.ctest b/contrib/ctest/hosts/epikur.local.ctest new file mode 100644 index 0000000..579e3dd --- /dev/null +++ b/contrib/ctest/hosts/epikur.local.ctest @@ -0,0 +1,7 @@ +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "epikur.local") +set(CTEST_BUILD_CONFIGURATION "Debug") + +set(CTEST_BUILD_NAME "darwin-x86_64 llvm generic") +include("tests/generic.ctest") +include("common.ctest.inc") diff --git a/contrib/ctest/run-tests.cron b/contrib/ctest/run-tests.cron new file mode 100755 index 0000000..2911cba --- /dev/null +++ b/contrib/ctest/run-tests.cron @@ -0,0 +1,79 @@ +#!/bin/bash + +set -e +ME=`basename $0` +TEST_DIR="$( cd "$( dirname "$0" )" && pwd )" +TESTS="$( cd $TEST_DIR/tests && pwd)" +HOSTS="$( cd $TEST_DIR/hosts && pwd)" +HOSTNAME="$( hostname )" +LOCK_DIR=/tmp/uscxml-build.lock +TESTFILE=$HOSTS/$HOSTNAME.ctest + +# cron has its own path, try to find ctest +if [ ! -n "${CTEST:+x}" ]; then + for SEARCH_PATH in "/usr/bin" "/usr/local/bin" "/opt/local/bin" + do + if [ -e $SEARCH_PATH/ctest ]; then + CTEST=$SEARCH_PATH/ctest + export CTEST + break + fi + done +fi +if [ ! -e "${CTEST}" ]; then + echo "Error: Could not find CTEST, set the CTEST environment variable." + exit; +fi + +if [ ! -n "${CTEST_SUBMIT_TYPE:+x}" ]; then + CTEST_SUBMIT_TYPE="Experimental" + export CTEST_SUBMIT_TYPE +fi + +# Try to find uscxml source if not given in USCXML_SOURCE_DIR +if [ ! -n "${USCXML_SOURCE_DIR:+x}" ]; then + # assume that this file is in ${USCXML_SOURCE_DIR}/contrib/ctest + # and use the directory two levels above. + USCXML_SOURCE_DIR="$( cd $TEST_DIR/../.. && pwd)" + export USCXML_SOURCE_DIR +fi + + +# is there a CMakeLists.txt file within? +if [ ! -e ${USCXML_SOURCE_DIR}/CMakeLists.txt ]; then + echo "Error: Could not find uscxml in ${USCXML_SOURCE_DIR}, set the USCXML_SOURCE_DIR environment variable." + exit; +fi + +if [ ! -e $TESTFILE ]; then + echo "Error: No tests for $HOSTNAME in $TESTFILE." + exit; +fi + +# +# Try to acquire the build lock +# +while true; do + if mkdir "$LOCK_DIR"; then + trap 'rm -rf "$LOCK_DIR"' 0 # remove directory when script finishes + break + else + echo "Could not get build lock - waiting" + sleep 10 + fi +done + +if [ "$CTEST_SUBMIT_TYPE" = "Continuous" ]; then + cd $USCXML_SOURCE_DIR + #git clean -f -d # careful - destructive! + GIT_SYNC=`git pull` + if [ "$GIT_SYNC" = "Already up-to-date." ]; then +# echo "Not running continuous tests, already up-to-date" + exit + else + echo $GIT_SYNC + fi +fi + +cd $TEST_DIR +nice $CTEST -VV --timeout 200 -S $TESTFILE
\ No newline at end of file diff --git a/contrib/ctest/run-tests.vbs b/contrib/ctest/run-tests.vbs new file mode 100644 index 0000000..9298fe0 --- /dev/null +++ b/contrib/ctest/run-tests.vbs @@ -0,0 +1,83 @@ +Set shell = CreateObject( "WScript.Shell" ) +Set fso = CreateObject("Scripting.FileSystemObject") +Set ip = CreateObject("WScript.Network") +Set procEnv = shell.Environment("Process") + +' see http://stackoverflow.com/questions/4692542/force-a-vbs-to-run-using-cscript-instead-of-wscript +Sub forceCScriptExecution + Dim Arg, Str + If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then + For Each Arg In WScript.Arguments + If InStr( Arg, " " ) Then Arg = """" & Arg & """" + Str = Str & " " & Arg + Next + shell.Run """" & VCVARSALL & """" & " && cscript //nologo """ & WScript.ScriptFullName & """" & Str + WScript.Sleep 1000 + WScript.Quit + End If +End Sub + +ME_NAME = Wscript.ScriptFullName +TEST_DIR = fso.GetParentFolderName(fso.GetFile(ME_NAME)) +TESTS = TEST_DIR + "\tests" +HOSTS = TEST_DIR + "\hosts" +HOSTNAME = LCase(ip.ComputerName) +TESTFILE = HOSTS + "\" + HOSTNAME + ".ctest" + +VCVARSALL = shell.ExpandEnvironmentStrings("%VCVARSALL%") +If VCVARSALL = "%VCVARSALL%" Then + VCVARSALL = "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" +End If +if (NOT fso.FileExists(VCVARSALL)) Then + MsgBox("Please export %VCVARSALL% as the command to get a build environment for msvc.") + WScript.Quit +End If + +CTEST_SUBMIT_TYPE = shell.ExpandEnvironmentStrings("%CTEST_SUBMIT_TYPE%") +If CTEST_SUBMIT_TYPE = "%CTEST_SUBMIT_TYPE%" Then + CTEST_SUBMIT_TYPE = "Experimental" + procEnv("CTEST_SUBMIT_TYPE") = CTEST_SUBMIT_TYPE +End If + +MILES_SOURCE_DIR = shell.ExpandEnvironmentStrings("%MILES_SOURCE_DIR%") +If MILES_SOURCE_DIR = "%MILES_SOURCE_DIR%" Then + MILES_SOURCE_DIR = fso.GetParentFolderName(fso.GetParentFolderName(TEST_DIR)) + procEnv("MILES_SOURCE_DIR") = MILES_SOURCE_DIR +End If + +MILES_SOURCE_DIR = shell.ExpandEnvironmentStrings("%MILES_SOURCE_DIR%") +if (NOT fso.FileExists(MILES_SOURCE_DIR + "\CMakeLists.txt")) Then + MsgBox "Could not find uMundo Source for " + ME_NAME + WScript.Quit +End If + +if (NOT fso.FileExists(TESTFILE)) Then + MsgBox "Could not find test file for this host at " + TESTFILE + WScript.Quit +End If + +' continue with cscript +forceCScriptExecution + +' Aqcuire lock to avoid concurrent builds +' this will throw a permission denied error :( + +Set buildLock = fso.OpenTextFile(TESTFILE, 8, True) + +' Check github for updates and quit when nothing's new +if (CTEST_SUBMIT_TYPE = "Continuous") Then + shell.CurrentDirectory = MILES_SOURCE_DIR + Set oExec = shell.Exec("git pull") + GIT_SYNC = oExec.StdOut.ReadLine + if (GIT_SYNC = "Already up-to-date.") Then + WScript.Quit + End If +End If + +shell.CurrentDirectory = TEST_DIR +Set exec = shell.Exec("CMD /S /C ctest -VV --timeout 100 -S " + TESTFILE + " 2>&1") +Do While exec.Status = 0 + WScript.Sleep 10 + WScript.StdOut.Write(exec.StdOut.ReadLine() & vbCRLF) +' WScript.StdErr.Write(exec.StdErr.ReadLine()) +Loop diff --git a/contrib/ctest/tests/generic.ctest b/contrib/ctest/tests/generic.ctest new file mode 100644 index 0000000..eb2b5fd --- /dev/null +++ b/contrib/ctest/tests/generic.ctest @@ -0,0 +1 @@ +set(CTEST_BUILD_OPTIONS "-DRUN_W3C_TESTS:BOOL=ON") |