From 2b64614618fc79728ba447ed9e15c5e7fd06af5e Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 28 Aug 2014 09:32:19 +0200 Subject: Retain ioProcs and invokers object in V8 and moved ctests from contrib to tests --- .travis.yml | 2 +- CMakeLists.txt | 2 +- CTestConfig.cmake | 2 +- README.md | 19 +-- contrib/ctest/CTestCustom.ctest.in | 41 ------ contrib/ctest/README.md | 93 +------------ contrib/ctest/common.ctest.inc | 155 --------------------- contrib/ctest/hosts/default.make.ctest | 24 ---- contrib/ctest/hosts/default.nmake.ctest | 24 ---- contrib/ctest/run-tests.cron | 75 +--------- contrib/ctest/run-tests.vbs | 80 +---------- contrib/ctest/tests/ecma.ctest | 4 - contrib/ctest/tests/general.ctest | 4 - contrib/ctest/tests/plugins-ecma.ctest | 4 - contrib/ctest/tests/xpath.ctest | 4 - .../datamodel/ecmascript/v8/V8DataModel.cpp | 50 ++++--- .../plugins/datamodel/ecmascript/v8/V8DataModel.h | 2 + test/ctest/CTestCustom.ctest.in | 41 ++++++ test/ctest/README.md | 91 ++++++++++++ test/ctest/common.ctest.inc | 155 +++++++++++++++++++++ test/ctest/hosts/default.make.ctest | 24 ++++ test/ctest/hosts/default.nmake.ctest | 24 ++++ test/ctest/run-tests.cron | 79 +++++++++++ test/ctest/run-tests.vbs | 87 ++++++++++++ test/ctest/tests/ecma.ctest | 4 + test/ctest/tests/general.ctest | 4 + test/ctest/tests/plugins-ecma.ctest | 4 + test/ctest/tests/xpath.ctest | 4 + 28 files changed, 561 insertions(+), 541 deletions(-) delete mode 100644 contrib/ctest/CTestCustom.ctest.in delete mode 100644 contrib/ctest/common.ctest.inc delete mode 100644 contrib/ctest/hosts/default.make.ctest delete mode 100644 contrib/ctest/hosts/default.nmake.ctest delete mode 100644 contrib/ctest/tests/ecma.ctest delete mode 100644 contrib/ctest/tests/general.ctest delete mode 100644 contrib/ctest/tests/plugins-ecma.ctest delete mode 100644 contrib/ctest/tests/xpath.ctest create mode 100644 test/ctest/CTestCustom.ctest.in create mode 100644 test/ctest/README.md create mode 100644 test/ctest/common.ctest.inc create mode 100644 test/ctest/hosts/default.make.ctest create mode 100644 test/ctest/hosts/default.nmake.ctest create mode 100755 test/ctest/run-tests.cron create mode 100644 test/ctest/run-tests.vbs create mode 100644 test/ctest/tests/ecma.ctest create mode 100644 test/ctest/tests/general.ctest create mode 100644 test/ctest/tests/plugins-ecma.ctest create mode 100644 test/ctest/tests/xpath.ctest 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) diff --git a/README.md b/README.md index 14841a9..f43c8a4 100644 --- a/README.md +++ b/README.md @@ -63,24 +63,7 @@ even in C# and Java. It runs on Linux, Windows, Raspberry Pi - Test#StatusDescriptionComment - - - - 326 / - 329 - - - Fails for v8 - "test that _ioprocessors stays bound till the session ends" / "test that none of the system variables can be modified" - The v8 implementation will return a new _ioprocessor object for each access, thus test for equality fails. - - +* 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/CTestCustom.ctest.in b/contrib/ctest/CTestCustom.ctest.in deleted file mode 100644 index 6b5fd3c..0000000 --- a/contrib/ctest/CTestCustom.ctest.in +++ /dev/null @@ -1,41 +0,0 @@ -# grep -ori 'datamodel="xpath' . -# skip xpath datamodel tests - -# grep -ori 'manual' . -# manual tests - -# grep -ori 'datamodel="null' . -# skip xpath datamodel tests - -# these are manual or xpath tests generated by the ecma generator -set(CTEST_CUSTOM_TESTS_IGNORE - "ecma/test178.scxml" # Manual - PASSED - "ecma/test230.scxml" # Manual - PASSED - "ecma/test250.scxml" # Manual - PASSED - "ecma/test301.scxml" # Manual - PASSED - "ecma/test307.scxml" # Manual - PASSED - "ecma/test415.scxml" # Manual - PASSED - - "fsm/ecma/test178.scxml" # manual test - "fsm/ecma/test224.scxml" # automatically generated id has the form stateid.platformid - "fsm/ecma/test230.scxml" # manual test - "fsm/ecma/test250.scxml" # manual test - "fsm/ecma/test307.scxml" # manual test - "fsm/ecma/test324.scxml" # _name can be assigned - "fsm/ecma/test329.scxml" # system variables can be modified - "fsm/ecma/test346.scxml" # change the value of a system variable - "fsm/ecma/test409.scxml" # In predicate - "fsm/ecma/test411.scxml" # In predicate - "fsm/ecma/test415.scxml" # manual test - "fsm/ecma/test436.scxml" # In predicate - "fsm/ecma/test519.scxml" # unspecified basichttp format - "fsm/ecma/test520.scxml" # unspecified basichttp format - "fsm/ecma/test531.scxml" # unspecified basichttp format - "fsm/ecma/test534.scxml" # unspecified basichttp format - "fsm/ecma/test567.scxml" # unspecified basichttp format - - "xpath/test580.scxml" # hangs -) - - - 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 -hosts/<HOSTNAME>.ctest - 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 - -Note: Be aware that run-tests.cron 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 -USCXML_SOURCE_DIR=/uscxml/checkout/here in the crontab line. - -Note: We will build in /tmp, make sure there is enough room for all three -build directories. - -Warning: run-tests.cron will pull the current GIT head. Use a -dedicated source checkout for testing if this is a problem. - -# How it works - -run-tests.cron will setup the environment to call your host-specific -test file with ctest. If you do not provide a value for -USCXML_SOURCE_DIR 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 run-tests.cron -* There is a path to the ctest executable in $ENV{CTEST} -* The current working directory is the ctest directory. -* The chosen submit type is available as $ENV{CTEST_SUBMIT_TYPE} -* The path to the umundo sources is available as $ENV{UMUNDO_SOURCE_DIR} - -As a host-specific test file, you are expected to prepare test-builds by setting -the following variables and call include("common.ctest.inc") for every -build you prepared. - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableComment
CTEST_SITEThe name of this build-slave for reporting in the dashboard. Should be the same for all submitted test-builds
CTEST_CMAKE_GENERATORThe generator to use with cmake (e.g. "Unix Makefiles")
CTEST_BUILD_CONFIGURATION"Debug", "Release" ..
CTEST_TOOLCHAINPath to a cmake toolchain file for cross compiling.
CTEST_BUILD_NAMEName of the particular build you are about to submit (e.g. "darwin-x86_64 llvm bonjour").
CTEST_BUILD_OPTIONSParameters to be passed to cmake when preparing the build. These will - most likely come from one of the tests/*.ctest files.
- -## 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 <USCXML_SRC>/test/ctest. Some files remain here for backward compatibility with existing +build slaves. diff --git a/contrib/ctest/common.ctest.inc b/contrib/ctest/common.ctest.inc deleted file mode 100644 index c95259c..0000000 --- a/contrib/ctest/common.ctest.inc +++ /dev/null @@ -1,155 +0,0 @@ -# -# 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-* -# - -### Custom ctest -# see http://lists.gforge.inria.fr/pipermail/simgrid-commits/2010-November/016461.html - -# CTEST_CUSTOM_ERROR_MATCH Regular expression for errors during build process -# CTEST_CUSTOM_ERROR_EXCEPTION Regular expression for error exceptions during build process -# CTEST_CUSTOM_WARNING_MATCH Regular expression for warnings during build process -# CTEST_CUSTOM_WARNING_EXCEPTION Regular expression for warning exception during build process -# CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS Maximum number of errors to display -# CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS Maximum number of warnings to display -# CTEST_CUSTOM_TESTS_IGNORE List of tests to ignore during the Test stage -# CTEST_CUSTOM_MEMCHECK_IGNORE List of tests to ignore during the MemCheck stage -# CTEST_CUSTOM_PRE_TEST Command to execute before any tests are run during Test stage -# CTEST_CUSTOM_POST_TEST Command to execute after any tests are run during Test stage -# CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE Maximum size of passed test output -# CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE Maximum size of failed test output -# CTEST_CUSTOM_PRE_MEMCHECK Command to execute before any tests are run during MemCheck stage -# CTEST_CUSTOM_POST_MEMCHECK Command to execute after any tests are run during MemCheck stage -# CTEST_CUSTOM_COVERAGE_EXCLUDE Regular expression for excluding files from coverage testing - -if ("$ENV{CTEST_SUBMIT_TYPE}" STREQUAL "") - set(CTEST_SUBMIT_TYPE "Experimental") - message(STATUS "ENV{CTEST_SUBMIT_TYPE} is emtpy - defaulting to Experimental") -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-uscxml-${CTEST_SUBMIT_TYPE}-${CTEST_SCRIPT_NAME}") - -if ("$ENV{USCXML_PLUGIN_PATH}" STREQUAL "") - set(ENV{USCXML_PLUGIN_PATH} /tmp/build-uscxml-${CTEST_SUBMIT_TYPE}-${CTEST_SCRIPT_NAME}/lib) -endif() - -set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 4194304) -set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 4194304) - -### Coverage and Memory checks? (untested) ################################ - -if (${CTEST_SUBMIT_TYPE} MATCHES "Nightly") - find_program(CTEST_COVERAGE_COMMAND NAMES gcov) - SET(CTEST_CUSTOM_COVERAGE_EXCLUDE - "${CTEST_SOURCE_DIRECTORY}/contrib/*" - ) -endif() - -set(CTEST_CUSTOM_WARNING_EXCEPTION - ".*will never be executed" -) - -#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 for everything but continuous tests -if (NOT RETAIN_BUILD_DIR) - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -endif() - -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(EXISTS "${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake") - include(${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) -elseif(EXISTS "${CTEST_BINARY_DIRECTORY}/CTestCustom.ctest") - include(${CTEST_BINARY_DIRECTORY}/CTestCustom.ctest) -endif() - -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 -if (NOT "${USCXML_EXCLUDE_LABEL_REGEX}" STREQUAL "") - ctest_test(EXCLUDE_LABEL ${USCXML_EXCLUDE_LABEL_REGEX}) -elseif(NOT "${USCXML_INCLUDE_LABEL_REGEX}" STREQUAL "") - ctest_test(INCLUDE_LABEL ${USCXML_INCLUDE_LABEL_REGEX}) -else() - ctest_test() -endif() - - -if(CTEST_COVERAGE_COMMAND) - ctest_coverage() -endif() -if (CTEST_MEMORYCHECK_COMMAND) - ctest_memcheck() -endif() - -ctest_submit() # submit diff --git a/contrib/ctest/hosts/default.make.ctest b/contrib/ctest/hosts/default.make.ctest deleted file mode 100644 index 12e161c..0000000 --- a/contrib/ctest/hosts/default.make.ctest +++ /dev/null @@ -1,24 +0,0 @@ -if (NOT HOSTNAME) - set(HOSTNAME "Unknown Host") -endif() - -set(CTEST_CMAKE_GENERATOR "Unix Makefiles") -set(CTEST_SITE "${HOSTNAME}") -set(CTEST_BUILD_CONFIGURATION "Debug") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}") - -set(RETAIN_BUILD_DIR OFF) -include("tests/general.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR ON) -include("tests/ecma.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR ON) -include("tests/xpath.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR OFF) -include("tests/plugins-ecma.ctest") -include("common.ctest.inc") diff --git a/contrib/ctest/hosts/default.nmake.ctest b/contrib/ctest/hosts/default.nmake.ctest deleted file mode 100644 index eac99b9..0000000 --- a/contrib/ctest/hosts/default.nmake.ctest +++ /dev/null @@ -1,24 +0,0 @@ -if (NOT HOSTNAME) - set(HOSTNAME "Unknown Host") -endif() - -set(CTEST_CMAKE_GENERATOR "NMake Makefiles") -set(CTEST_SITE "${HOSTNAME}") -set(CTEST_BUILD_CONFIGURATION "Debug") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}") - -set(RETAIN_BUILD_DIR OFF) -include("tests/general.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR ON) -include("tests/ecma.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR ON) -include("tests/xpath.ctest") -include("common.ctest.inc") - -set(RETAIN_BUILD_DIR OFF) -include("tests/plugins-ecma.ctest") -include("common.ctest.inc") 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/contrib/ctest/tests/ecma.ctest b/contrib/ctest/tests/ecma.ctest deleted file mode 100644 index 8659120..0000000 --- a/contrib/ctest/tests/ecma.ctest +++ /dev/null @@ -1,4 +0,0 @@ -set(CTEST_BUILD_OPTIONS "-DRUN_W3C_ECMA_TESTS:BOOL=ON -DENABLE_GCOV:BOOL=ON") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - ecma") -set(USCXML_INCLUDE_LABEL_REGEX ".*ecma.*") -set(USCXML_EXCLUDE_LABEL_REGEX "") \ No newline at end of file diff --git a/contrib/ctest/tests/general.ctest b/contrib/ctest/tests/general.ctest deleted file mode 100644 index fd120fa..0000000 --- a/contrib/ctest/tests/general.ctest +++ /dev/null @@ -1,4 +0,0 @@ -set(CTEST_BUILD_OPTIONS "-DENABLE_GCOV:BOOL=ON") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - general") -set(USCXML_INCLUDE__LABEL_REGEX "") -set(USCXML_EXCLUDE_LABEL_REGEX ".*[ecma|xpath].*") diff --git a/contrib/ctest/tests/plugins-ecma.ctest b/contrib/ctest/tests/plugins-ecma.ctest deleted file mode 100644 index 288aac0..0000000 --- a/contrib/ctest/tests/plugins-ecma.ctest +++ /dev/null @@ -1,4 +0,0 @@ -set(CTEST_BUILD_OPTIONS "-DBUILD_AS_PLUGINS=ON -DENABLE_GCOV:BOOL=ON") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - plugins") -set(USCXML_INCLUDE_LABEL_REGEX ".*ecma.*") -set(USCXML_EXCLUDE_LABEL_REGEX "") diff --git a/contrib/ctest/tests/xpath.ctest b/contrib/ctest/tests/xpath.ctest deleted file mode 100644 index ca43fbe..0000000 --- a/contrib/ctest/tests/xpath.ctest +++ /dev/null @@ -1,4 +0,0 @@ -set(CTEST_BUILD_OPTIONS "-DRUN_W3C_XPATH_TESTS:BOOL=ON -DENABLE_GCOV:BOOL=ON") -set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - xpath") -set(USCXML_INCLUDE_LABEL_REGEX ".*xpath.*") -set(USCXML_EXCLUDE_LABEL_REGEX "") 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 property, v8::Local V8DataModel::getIOProcessors(v8::Local property, const v8::AccessorInfo& info) { V8DataModel* dataModel = V8DOM::toClassPtr(info.Data()); - dataModel->_ioProcessors = v8::Persistent::New(v8::Object::New()); - //v8::Handle ioProcessorObj = v8::Object::New(); - std::map ioProcessors = dataModel->_interpreter->getIOProcessors(); - std::map::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::New(v8::Object::New()); + //v8::Handle ioProcessorObj = v8::Object::New(); + std::map ioProcessors = dataModel->_interpreter->getIOProcessors(); + std::map::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 V8DataModel::getIOProcessors(v8::Local propert v8::Handle V8DataModel::getInvokers(v8::Local property, const v8::AccessorInfo& info) { V8DataModel* dataModel = V8DOM::toClassPtr(info.Data()); - dataModel->_invokers = v8::Persistent::New(v8::Object::New()); - //v8::Handle ioProcessorObj = v8::Object::New(); - std::map invokers = dataModel->_interpreter->getInvokers(); - std::map::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::New(v8::Object::New()); + //v8::Handle ioProcessorObj = v8::Object::New(); + std::map invokers = dataModel->_interpreter->getInvokers(); + std::map::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 _ioProcessors; v8::Persistent _invokers; static v8::Handle getIOProcessors(v8::Local property, const v8::AccessorInfo& info); diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in new file mode 100644 index 0000000..6b5fd3c --- /dev/null +++ b/test/ctest/CTestCustom.ctest.in @@ -0,0 +1,41 @@ +# grep -ori 'datamodel="xpath' . +# skip xpath datamodel tests + +# grep -ori 'manual' . +# manual tests + +# grep -ori 'datamodel="null' . +# skip xpath datamodel tests + +# these are manual or xpath tests generated by the ecma generator +set(CTEST_CUSTOM_TESTS_IGNORE + "ecma/test178.scxml" # Manual - PASSED + "ecma/test230.scxml" # Manual - PASSED + "ecma/test250.scxml" # Manual - PASSED + "ecma/test301.scxml" # Manual - PASSED + "ecma/test307.scxml" # Manual - PASSED + "ecma/test415.scxml" # Manual - PASSED + + "fsm/ecma/test178.scxml" # manual test + "fsm/ecma/test224.scxml" # automatically generated id has the form stateid.platformid + "fsm/ecma/test230.scxml" # manual test + "fsm/ecma/test250.scxml" # manual test + "fsm/ecma/test307.scxml" # manual test + "fsm/ecma/test324.scxml" # _name can be assigned + "fsm/ecma/test329.scxml" # system variables can be modified + "fsm/ecma/test346.scxml" # change the value of a system variable + "fsm/ecma/test409.scxml" # In predicate + "fsm/ecma/test411.scxml" # In predicate + "fsm/ecma/test415.scxml" # manual test + "fsm/ecma/test436.scxml" # In predicate + "fsm/ecma/test519.scxml" # unspecified basichttp format + "fsm/ecma/test520.scxml" # unspecified basichttp format + "fsm/ecma/test531.scxml" # unspecified basichttp format + "fsm/ecma/test534.scxml" # unspecified basichttp format + "fsm/ecma/test567.scxml" # unspecified basichttp format + + "xpath/test580.scxml" # hangs +) + + + 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 +hosts/<HOSTNAME>.ctest - 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 + +Note: Be aware that run-tests.cron 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 +USCXML_SOURCE_DIR=/uscxml/checkout/here in the crontab line. + +Note: We will build in /tmp, make sure there is enough room for all three +build directories. + +Warning: run-tests.cron will pull the current GIT head. Use a +dedicated source checkout for testing if this is a problem. + +# How it works + +run-tests.cron will setup the environment to call your host-specific +test file with ctest. If you do not provide a value for +USCXML_SOURCE_DIR 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 run-tests.cron +* There is a path to the ctest executable in $ENV{CTEST} +* The current working directory is the ctest directory. +* The chosen submit type is available as $ENV{CTEST_SUBMIT_TYPE} +* The path to the umundo sources is available as $ENV{UMUNDO_SOURCE_DIR} + +As a host-specific test file, you are expected to prepare test-builds by setting +the following variables and call include("common.ctest.inc") for every +build you prepared. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableComment
CTEST_SITEThe name of this build-slave for reporting in the dashboard. Should be the same for all submitted test-builds
CTEST_CMAKE_GENERATORThe generator to use with cmake (e.g. "Unix Makefiles")
CTEST_BUILD_CONFIGURATION"Debug", "Release" ..
CTEST_TOOLCHAINPath to a cmake toolchain file for cross compiling.
CTEST_BUILD_NAMEName of the particular build you are about to submit (e.g. "darwin-x86_64 llvm bonjour").
CTEST_BUILD_OPTIONSParameters to be passed to cmake when preparing the build. These will + most likely come from one of the tests/*.ctest files.
+ +## 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/test/ctest/common.ctest.inc b/test/ctest/common.ctest.inc new file mode 100644 index 0000000..c95259c --- /dev/null +++ b/test/ctest/common.ctest.inc @@ -0,0 +1,155 @@ +# +# 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-* +# + +### Custom ctest +# see http://lists.gforge.inria.fr/pipermail/simgrid-commits/2010-November/016461.html + +# CTEST_CUSTOM_ERROR_MATCH Regular expression for errors during build process +# CTEST_CUSTOM_ERROR_EXCEPTION Regular expression for error exceptions during build process +# CTEST_CUSTOM_WARNING_MATCH Regular expression for warnings during build process +# CTEST_CUSTOM_WARNING_EXCEPTION Regular expression for warning exception during build process +# CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS Maximum number of errors to display +# CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS Maximum number of warnings to display +# CTEST_CUSTOM_TESTS_IGNORE List of tests to ignore during the Test stage +# CTEST_CUSTOM_MEMCHECK_IGNORE List of tests to ignore during the MemCheck stage +# CTEST_CUSTOM_PRE_TEST Command to execute before any tests are run during Test stage +# CTEST_CUSTOM_POST_TEST Command to execute after any tests are run during Test stage +# CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE Maximum size of passed test output +# CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE Maximum size of failed test output +# CTEST_CUSTOM_PRE_MEMCHECK Command to execute before any tests are run during MemCheck stage +# CTEST_CUSTOM_POST_MEMCHECK Command to execute after any tests are run during MemCheck stage +# CTEST_CUSTOM_COVERAGE_EXCLUDE Regular expression for excluding files from coverage testing + +if ("$ENV{CTEST_SUBMIT_TYPE}" STREQUAL "") + set(CTEST_SUBMIT_TYPE "Experimental") + message(STATUS "ENV{CTEST_SUBMIT_TYPE} is emtpy - defaulting to Experimental") +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-uscxml-${CTEST_SUBMIT_TYPE}-${CTEST_SCRIPT_NAME}") + +if ("$ENV{USCXML_PLUGIN_PATH}" STREQUAL "") + set(ENV{USCXML_PLUGIN_PATH} /tmp/build-uscxml-${CTEST_SUBMIT_TYPE}-${CTEST_SCRIPT_NAME}/lib) +endif() + +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 4194304) +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 4194304) + +### Coverage and Memory checks? (untested) ################################ + +if (${CTEST_SUBMIT_TYPE} MATCHES "Nightly") + find_program(CTEST_COVERAGE_COMMAND NAMES gcov) + SET(CTEST_CUSTOM_COVERAGE_EXCLUDE + "${CTEST_SOURCE_DIRECTORY}/contrib/*" + ) +endif() + +set(CTEST_CUSTOM_WARNING_EXCEPTION + ".*will never be executed" +) + +#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 for everything but continuous tests +if (NOT RETAIN_BUILD_DIR) + ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) +endif() + +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(EXISTS "${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake") + include(${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +elseif(EXISTS "${CTEST_BINARY_DIRECTORY}/CTestCustom.ctest") + include(${CTEST_BINARY_DIRECTORY}/CTestCustom.ctest) +endif() + +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 +if (NOT "${USCXML_EXCLUDE_LABEL_REGEX}" STREQUAL "") + ctest_test(EXCLUDE_LABEL ${USCXML_EXCLUDE_LABEL_REGEX}) +elseif(NOT "${USCXML_INCLUDE_LABEL_REGEX}" STREQUAL "") + ctest_test(INCLUDE_LABEL ${USCXML_INCLUDE_LABEL_REGEX}) +else() + ctest_test() +endif() + + +if(CTEST_COVERAGE_COMMAND) + ctest_coverage() +endif() +if (CTEST_MEMORYCHECK_COMMAND) + ctest_memcheck() +endif() + +ctest_submit() # submit diff --git a/test/ctest/hosts/default.make.ctest b/test/ctest/hosts/default.make.ctest new file mode 100644 index 0000000..12e161c --- /dev/null +++ b/test/ctest/hosts/default.make.ctest @@ -0,0 +1,24 @@ +if (NOT HOSTNAME) + set(HOSTNAME "Unknown Host") +endif() + +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +set(CTEST_SITE "${HOSTNAME}") +set(CTEST_BUILD_CONFIGURATION "Debug") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}") + +set(RETAIN_BUILD_DIR OFF) +include("tests/general.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR ON) +include("tests/ecma.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR ON) +include("tests/xpath.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR OFF) +include("tests/plugins-ecma.ctest") +include("common.ctest.inc") diff --git a/test/ctest/hosts/default.nmake.ctest b/test/ctest/hosts/default.nmake.ctest new file mode 100644 index 0000000..eac99b9 --- /dev/null +++ b/test/ctest/hosts/default.nmake.ctest @@ -0,0 +1,24 @@ +if (NOT HOSTNAME) + set(HOSTNAME "Unknown Host") +endif() + +set(CTEST_CMAKE_GENERATOR "NMake Makefiles") +set(CTEST_SITE "${HOSTNAME}") +set(CTEST_BUILD_CONFIGURATION "Debug") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}") + +set(RETAIN_BUILD_DIR OFF) +include("tests/general.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR ON) +include("tests/ecma.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR ON) +include("tests/xpath.ctest") +include("common.ctest.inc") + +set(RETAIN_BUILD_DIR OFF) +include("tests/plugins-ecma.ctest") +include("common.ctest.inc") 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/test/ctest/tests/ecma.ctest b/test/ctest/tests/ecma.ctest new file mode 100644 index 0000000..8659120 --- /dev/null +++ b/test/ctest/tests/ecma.ctest @@ -0,0 +1,4 @@ +set(CTEST_BUILD_OPTIONS "-DRUN_W3C_ECMA_TESTS:BOOL=ON -DENABLE_GCOV:BOOL=ON") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - ecma") +set(USCXML_INCLUDE_LABEL_REGEX ".*ecma.*") +set(USCXML_EXCLUDE_LABEL_REGEX "") \ No newline at end of file diff --git a/test/ctest/tests/general.ctest b/test/ctest/tests/general.ctest new file mode 100644 index 0000000..fd120fa --- /dev/null +++ b/test/ctest/tests/general.ctest @@ -0,0 +1,4 @@ +set(CTEST_BUILD_OPTIONS "-DENABLE_GCOV:BOOL=ON") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - general") +set(USCXML_INCLUDE__LABEL_REGEX "") +set(USCXML_EXCLUDE_LABEL_REGEX ".*[ecma|xpath].*") diff --git a/test/ctest/tests/plugins-ecma.ctest b/test/ctest/tests/plugins-ecma.ctest new file mode 100644 index 0000000..288aac0 --- /dev/null +++ b/test/ctest/tests/plugins-ecma.ctest @@ -0,0 +1,4 @@ +set(CTEST_BUILD_OPTIONS "-DBUILD_AS_PLUGINS=ON -DENABLE_GCOV:BOOL=ON") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - plugins") +set(USCXML_INCLUDE_LABEL_REGEX ".*ecma.*") +set(USCXML_EXCLUDE_LABEL_REGEX "") diff --git a/test/ctest/tests/xpath.ctest b/test/ctest/tests/xpath.ctest new file mode 100644 index 0000000..ca43fbe --- /dev/null +++ b/test/ctest/tests/xpath.ctest @@ -0,0 +1,4 @@ +set(CTEST_BUILD_OPTIONS "-DRUN_W3C_XPATH_TESTS:BOOL=ON -DENABLE_GCOV:BOOL=ON") +set(CTEST_BUILD_NAME "${CMAKE_SYSTEM} - xpath") +set(USCXML_INCLUDE_LABEL_REGEX ".*xpath.*") +set(USCXML_EXCLUDE_LABEL_REGEX "") -- cgit v0.12