diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | CTestConfig.cmake | 2 | ||||
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | contrib/ctest/README.md | 93 | ||||
-rwxr-xr-x | contrib/ctest/run-tests.cron | 75 | ||||
-rw-r--r-- | contrib/ctest/run-tests.vbs | 80 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp | 50 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h | 2 | ||||
-rw-r--r-- | test/ctest/CTestCustom.ctest.in (renamed from contrib/ctest/CTestCustom.ctest.in) | 0 | ||||
-rw-r--r-- | test/ctest/README.md | 91 | ||||
-rw-r--r-- | test/ctest/common.ctest.inc (renamed from contrib/ctest/common.ctest.inc) | 0 | ||||
-rw-r--r-- | test/ctest/hosts/default.make.ctest (renamed from contrib/ctest/hosts/default.make.ctest) | 0 | ||||
-rw-r--r-- | test/ctest/hosts/default.nmake.ctest (renamed from contrib/ctest/hosts/default.nmake.ctest) | 0 | ||||
-rwxr-xr-x | test/ctest/run-tests.cron | 79 | ||||
-rw-r--r-- | test/ctest/run-tests.vbs | 87 | ||||
-rw-r--r-- | test/ctest/tests/ecma.ctest (renamed from contrib/ctest/tests/ecma.ctest) | 0 | ||||
-rw-r--r-- | test/ctest/tests/general.ctest (renamed from contrib/ctest/tests/general.ctest) | 0 | ||||
-rw-r--r-- | test/ctest/tests/plugins-ecma.ctest (renamed from contrib/ctest/tests/plugins-ecma.ctest) | 0 | ||||
-rw-r--r-- | test/ctest/tests/xpath.ctest (renamed from contrib/ctest/tests/xpath.ctest) | 0 |
20 files changed, 301 insertions, 281 deletions
diff --git a/.travis.yml b/.travis.yml index 7eea956..d4a7d8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ before_install: - sudo apt-get install -qq swi-prolog - wget http://uscxml.tk.informatik.tu-darmstadt.de || true -script: mkdir build && cd build && cmake .. && make +script: mkdir build && cd build && cmake .. && make && ctest diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bcccb9..42c21f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1287,7 +1287,7 @@ endif() # enable config.h style compile time options and add as "uscxml/config.h" configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/uscxml/config.h) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contrib/ctest/CTestCustom.ctest.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.ctest @ONCE) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/ctest/CTestCustom.ctest.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.ctest @ONCE) ############################################################ # Some concluding remarks diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 89043b5..77b3480 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -9,6 +9,6 @@ set(CTEST_PROJECT_NAME "uscxml") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "umundo.mintwerk.de") +set(CTEST_DROP_SITE "uscxml.tk.informatik.tu-darmstadt.de") set(CTEST_DROP_LOCATION "/cdash/submit.php?project=uscxml") set(CTEST_DROP_SITE_CDASH TRUE) @@ -63,24 +63,7 @@ even in C# and Java. It runs on <b>Linux</b>, <b>Windows</b>, <b>Raspberry Pi</b * We continuously run the [W3C IRP tests](http://www.w3.org/Voice/2013/scxml-irp/) for SCXML. * Have a look at the [result](http://uscxml.tk.informatik.tu-darmstadt.de/cdash/index.php?project=uscxml) for the various platforms. -* The manual and XPath specific tests are [excluded](https://github.com/tklab-tud/uscxml/blob/master/contrib/ctest/CTestCustom.ctest.in). - -uSCXML still fails the following ecmascript tests: - -<table> - <tr><th>Test#</th><th>Status</th><th>Description</th><th>Comment</th></tr> - <tr> - <td> - <tt> - <a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test326.scxml">326</a> / - <a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test326.scxml">329</a> - </tt> - </td> - <td><tt>Fails for v8</tt></td> - <td>"test that _ioprocessors stays bound till the session ends" / "test that none of the system variables can be modified"</td> - <td>The v8 implementation will return a new <tt>_ioprocessor</tt> object for each access, thus test for equality fails.</td> - </tr> -</table> +* The manual and XPath specific tests are [excluded](https://github.com/tklab-tud/uscxml/blob/master/test/ctest/CTestCustom.ctest.in). ### License diff --git a/contrib/ctest/README.md b/contrib/ctest/README.md index 1815bdc..c4a54a8 100644 --- a/contrib/ctest/README.md +++ b/contrib/ctest/README.md @@ -1,91 +1,2 @@ -# 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") - +Folder moved to <tt><USCXML_SRC>/test/ctest</tt>. Some files remain here for backward compatibility with existing +build slaves. diff --git a/contrib/ctest/run-tests.cron b/contrib/ctest/run-tests.cron index 24a6f85..b3a34fd 100755 --- a/contrib/ctest/run-tests.cron +++ b/contrib/ctest/run-tests.cron @@ -1,79 +1,6 @@ #!/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 "Warning: No tests for $HOSTNAME in $TESTFILE - defaulting." - TESTFILE=$HOSTS/default.make.ctest -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 20 -S $TESTFILE -DHOSTNAME=$HOSTNAME
\ No newline at end of file +${TEST_DIR}/../../test/ctest/run-tests.cron
\ No newline at end of file diff --git a/contrib/ctest/run-tests.vbs b/contrib/ctest/run-tests.vbs index 6f73ddf..47511b2 100644 --- a/contrib/ctest/run-tests.vbs +++ b/contrib/ctest/run-tests.vbs @@ -3,85 +3,13 @@ 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 - VCVARSALL = "C:\Program Files (x86)\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 +ACTUAL_CMD = TEST_DIR + "\..\..\test\ctest\run-tests.vbs" -USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%") -If USCXML_SOURCE_DIR = "%USCXML_SOURCE_DIR%" Then - USCXML_SOURCE_DIR = fso.GetParentFolderName(fso.GetParentFolderName(TEST_DIR)) - procEnv("USCXML_SOURCE_DIR") = USCXML_SOURCE_DIR -End If - -USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%") -if (NOT fso.FileExists(USCXML_SOURCE_DIR + "\CMakeLists.txt")) Then - MsgBox "Could not find uSCXML Source for " + ME_NAME +if (NOT fso.FileExists(ACTUAL_CMD)) Then + MsgBox "Could not find actual script at " + ACTUAL_CMD WScript.Quit End If -if (NOT fso.FileExists(TESTFILE)) Then - MsgBox "Warning: Could not find test file for this host at " + TESTFILE + " - defaulting" - TESTFILE = HOSTS + "\default.nmake.ctest" -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 = USCXML_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 /K ctest -VV --timeout 100 -S " + TESTFILE + " -DHOSTNAME=" + HOSTNAME + " 2>&1") -Do While exec.Status = 0 - WScript.Sleep 10 - WScript.StdOut.Write(exec.StdOut.ReadLine() & vbCRLF) -' WScript.StdErr.Write(exec.StdErr.ReadLine()) -Loop +shell.Run ACTUAL_CMD
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index 7b0b8e9..f8c9203 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -17,6 +17,11 @@ * @endcond */ +/* + * Later v8 changed API considerably, have a look at the node.js(!) documentatio for an overview: + * http://strongloop.com/strongblog/node-js-v0-12-c-apis-breaking/ + */ + #include "uscxml/Common.h" #include "uscxml/config.h" #include "V8DataModel.h" @@ -72,7 +77,7 @@ bool pluginConnect(pluma::Host& host) { } #endif -V8DataModel::V8DataModel() { +V8DataModel::V8DataModel() : _ioProcessorsAreSet(false), _invokersAreSet(false) { // _contexts.push_back(v8::Context::New()); } @@ -170,15 +175,18 @@ void V8DataModel::setWithException(v8::Local<v8::String> property, v8::Local<v8: v8::Handle<v8::Value> V8DataModel::getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info) { V8DataModel* dataModel = V8DOM::toClassPtr<V8DataModel>(info.Data()); - dataModel->_ioProcessors = v8::Persistent<v8::Object>::New(v8::Object::New()); - //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); - std::map<std::string, IOProcessor> ioProcessors = dataModel->_interpreter->getIOProcessors(); - std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin(); - while(ioProcIter != ioProcessors.end()) { -// std::cout << ioProcIter->first << std::endl; - dataModel->_ioProcessors->Set(v8::String::New(ioProcIter->first.c_str()), - dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables())); - ioProcIter++; + if (!dataModel->_ioProcessorsAreSet) { + dataModel->_ioProcessors = v8::Persistent<v8::Object>::New(v8::Object::New()); + //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); + std::map<std::string, IOProcessor> ioProcessors = dataModel->_interpreter->getIOProcessors(); + std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin(); + while(ioProcIter != ioProcessors.end()) { + // std::cout << ioProcIter->first << std::endl; + dataModel->_ioProcessors->Set(v8::String::New(ioProcIter->first.c_str()), + dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables())); + ioProcIter++; + } + dataModel->_ioProcessorsAreSet = true; } return dataModel->_ioProcessors; } @@ -186,15 +194,19 @@ v8::Handle<v8::Value> V8DataModel::getIOProcessors(v8::Local<v8::String> propert v8::Handle<v8::Value> V8DataModel::getInvokers(v8::Local<v8::String> property, const v8::AccessorInfo& info) { V8DataModel* dataModel = V8DOM::toClassPtr<V8DataModel>(info.Data()); - dataModel->_invokers = v8::Persistent<v8::Object>::New(v8::Object::New()); - //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); - std::map<std::string, Invoker> invokers = dataModel->_interpreter->getInvokers(); - std::map<std::string, Invoker>::const_iterator invokerIter = invokers.begin(); - while(invokerIter != invokers.end()) { - // std::cout << ioProcIter->first << std::endl; - dataModel->_invokers->Set(v8::String::New(invokerIter->first.c_str()), - dataModel->getDataAsValue(invokerIter->second.getDataModelVariables())); - invokerIter++; + if (!dataModel->_invokersAreSet) { + dataModel->_invokers = v8::Persistent<v8::Object>::New(v8::Object::New()); + //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); + std::map<std::string, Invoker> invokers = dataModel->_interpreter->getInvokers(); + std::map<std::string, Invoker>::const_iterator invokerIter = invokers.begin(); + while(invokerIter != invokers.end()) { + // std::cout << ioProcIter->first << std::endl; + dataModel->_invokers->Set(v8::String::New(invokerIter->first.c_str()), + dataModel->getDataAsValue(invokerIter->second.getDataModelVariables())); + invokerIter++; + } + dataModel->_invokersAreSet = true; + } return dataModel->_invokers; } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index e67a5ab..b114550 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -104,6 +104,8 @@ protected: Arabica::DOM::V8DOM* _dom; + bool _ioProcessorsAreSet; + bool _invokersAreSet; v8::Persistent<v8::Object> _ioProcessors; v8::Persistent<v8::Object> _invokers; static v8::Handle<v8::Value> getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info); diff --git a/contrib/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index 6b5fd3c..6b5fd3c 100644 --- a/contrib/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in diff --git a/test/ctest/README.md b/test/ctest/README.md new file mode 100644 index 0000000..4e52e8a --- /dev/null +++ b/test/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/test/ctest/run-tests.cron + 0 2 * * * CTEST_SUBMIT_TYPE="Nightly" /home/autobuilder/uscxml/test/ctest/run-tests.cron + */2 * * * * CTEST_SUBMIT_TYPE="Continuous" /home/autobuilder/uscxml/test/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/test/ctest/common.ctest.inc index c95259c..c95259c 100644 --- a/contrib/ctest/common.ctest.inc +++ b/test/ctest/common.ctest.inc diff --git a/contrib/ctest/hosts/default.make.ctest b/test/ctest/hosts/default.make.ctest index 12e161c..12e161c 100644 --- a/contrib/ctest/hosts/default.make.ctest +++ b/test/ctest/hosts/default.make.ctest diff --git a/contrib/ctest/hosts/default.nmake.ctest b/test/ctest/hosts/default.nmake.ctest index eac99b9..eac99b9 100644 --- a/contrib/ctest/hosts/default.nmake.ctest +++ b/test/ctest/hosts/default.nmake.ctest diff --git a/test/ctest/run-tests.cron b/test/ctest/run-tests.cron new file mode 100755 index 0000000..24a6f85 --- /dev/null +++ b/test/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 "Warning: No tests for $HOSTNAME in $TESTFILE - defaulting." + TESTFILE=$HOSTS/default.make.ctest +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 20 -S $TESTFILE -DHOSTNAME=$HOSTNAME
\ No newline at end of file diff --git a/test/ctest/run-tests.vbs b/test/ctest/run-tests.vbs new file mode 100644 index 0000000..6f73ddf --- /dev/null +++ b/test/ctest/run-tests.vbs @@ -0,0 +1,87 @@ +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 + VCVARSALL = "C:\Program Files (x86)\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 + +USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%") +If USCXML_SOURCE_DIR = "%USCXML_SOURCE_DIR%" Then + USCXML_SOURCE_DIR = fso.GetParentFolderName(fso.GetParentFolderName(TEST_DIR)) + procEnv("USCXML_SOURCE_DIR") = USCXML_SOURCE_DIR +End If + +USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%") +if (NOT fso.FileExists(USCXML_SOURCE_DIR + "\CMakeLists.txt")) Then + MsgBox "Could not find uSCXML Source for " + ME_NAME + WScript.Quit +End If + +if (NOT fso.FileExists(TESTFILE)) Then + MsgBox "Warning: Could not find test file for this host at " + TESTFILE + " - defaulting" + TESTFILE = HOSTS + "\default.nmake.ctest" +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 = USCXML_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 /K ctest -VV --timeout 100 -S " + TESTFILE + " -DHOSTNAME=" + HOSTNAME + " 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/ecma.ctest b/test/ctest/tests/ecma.ctest index 8659120..8659120 100644 --- a/contrib/ctest/tests/ecma.ctest +++ b/test/ctest/tests/ecma.ctest diff --git a/contrib/ctest/tests/general.ctest b/test/ctest/tests/general.ctest index fd120fa..fd120fa 100644 --- a/contrib/ctest/tests/general.ctest +++ b/test/ctest/tests/general.ctest diff --git a/contrib/ctest/tests/plugins-ecma.ctest b/test/ctest/tests/plugins-ecma.ctest index 288aac0..288aac0 100644 --- a/contrib/ctest/tests/plugins-ecma.ctest +++ b/test/ctest/tests/plugins-ecma.ctest diff --git a/contrib/ctest/tests/xpath.ctest b/test/ctest/tests/xpath.ctest index ca43fbe..ca43fbe 100644 --- a/contrib/ctest/tests/xpath.ctest +++ b/test/ctest/tests/xpath.ctest |