diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-06-16 14:51:27 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-06-16 14:51:27 (GMT) |
commit | fa6b4f074d4be04d913d8b7dc062920341c34ecb (patch) | |
tree | 83ae475b184a3b1bccca2a69addcefb6c12d924e /test | |
parent | ed6aee05e2843be65c4ab445d79e70dc8dacc07b (diff) | |
download | uscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.zip uscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.tar.gz uscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.tar.bz2 |
Fixed issue86 and some more bug fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 50 | ||||
-rw-r--r-- | test/ctest/CTestCustom.ctest.in | 2 | ||||
-rw-r--r-- | test/issues/test-issue86.scxml | 36 | ||||
-rw-r--r-- | test/src/test-gen-c.cpp | 9 | ||||
-rw-r--r-- | test/src/test-stress.cpp | 7 |
5 files changed, 81 insertions, 23 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5ef92c6..8719a41 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -28,7 +28,10 @@ USCXML_TEST_COMPILE(NAME test-url LABEL general/test-url FILES src/test-url.cpp) USCXML_TEST_COMPILE(NAME test-lifecycle LABEL general/test-lifecycle FILES src/test-lifecycle.cpp) USCXML_TEST_COMPILE(NAME test-validating LABEL general/test-validating FILES src/test-validating.cpp) USCXML_TEST_COMPILE(NAME test-snippets LABEL general/test-snippets FILES src/test-snippets.cpp) -USCXML_TEST_COMPILE(NAME test-stress LABEL general/test-stress FILES src/test-stress.cpp) + +# test-stress is not an automated test +add_executable(test-stress src/test-stress.cpp) +target_link_libraries(test-stress uscxml) file(GLOB_RECURSE USCXML_WRAPPERS ${PROJECT_SOURCE_DIR}/src/bindings/swig/wrapped/*.cpp @@ -140,7 +143,7 @@ if (NOT BUILD_MINIMAL) # "perf/gen/c/ecma" # "perf/ecma" ) - + # prepare directories for test classes and copy resources over foreach(W3C_RESOURCE ${W3C_RESOURCES} ) get_filename_component(TEST_DATAMODEL ${W3C_RESOURCE} PATH) @@ -183,13 +186,22 @@ if (NOT BUILD_MINIMAL) # normal IRP tests - get all scxml files within foreach(W3C_TEST ${W3C_TESTS} ) + set(TEST_ADDED OFF) get_filename_component(TEST_FILE ${W3C_TEST} NAME) set(TEST_NAME "w3c/${TEST_CLASS}/${TEST_FILE}") - if (NOT TEST_NAME MATCHES ".*sub.*") + if (OFF) + # manual tests: + elseif (TEST_FILE STREQUAL "test307.scxml") + # scxml files, but no proper tests: + elseif (TEST_NAME MATCHES ".*sub.*") + # rest is a proper test: + else () + if (IS_STANDARD_TEST) add_test(${TEST_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-state-pass ${W3C_TEST}) + set(TEST_ADDED ON) if (TEST_NAME MATCHES ".*/test250.scxml") set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "entering final state, invocation was not cancelled") @@ -226,20 +238,24 @@ if (NOT BUILD_MINIMAL) -DSCAFFOLDING_FOR_GENERATED_C:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/src/test-gen-c.cpp -P ${CMAKE_CURRENT_SOURCE_DIR}/ctest/scripts/run_generated_test.cmake) set_tests_properties("${TEST_NAME}" PROPERTIES DEPENDS uscxml-transform) + set(TEST_ADDED ON) endif() elseif (TEST_TYPE MATCHES "^binding.*") get_filename_component(TEST_LANG ${TEST_TYPE} NAME) - add_test(NAME "${TEST_NAME}" - COMMAND - ${ANT_EXECUTABLE} - -Dtest.file=${W3C_TEST} - -Duscxml.jar=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/uscxml.jar - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/java - ) - set_tests_properties("${TEST_NAME}" PROPERTIES DEPENDS jar) + if (TARGET jar AND TEST_LANG STREQUAL "java") + add_test(NAME "${TEST_NAME}" + COMMAND + ${ANT_EXECUTABLE} + -Dtest.file=${W3C_TEST} + -Duscxml.jar=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/uscxml.jar + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/java + ) + set_tests_properties("${TEST_NAME}" PROPERTIES DEPENDS jar) + set(TEST_ADDED ON) + endif() elseif (TEST_TYPE MATCHES "^spin.*") @@ -257,18 +273,22 @@ if (NOT BUILD_MINIMAL) -P ${CMAKE_CURRENT_SOURCE_DIR}/ctest/scripts/run_promela_test.cmake) set_tests_properties("${TEST_NAME}" PROPERTIES PASS_REGULAR_EXPRESSION "depth reached [0-9]+, errors: 0") set_tests_properties("${TEST_NAME}" PROPERTIES FAIL_REGULAR_EXPRESSION "depth reached [0-9]+, errors: [1-9]+") + set(TEST_ADDED ON) elseif (TEST_TYPE MATCHES "^fsm.*") add_test("${TEST_NAME}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-state-pass -f ${W3C_TEST}) + set(TEST_ADDED ON) endif() endif() - set_property(TEST ${TEST_NAME} PROPERTY LABELS ${TEST_NAME}) - set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT ${TEST_TIMEOUT}) - if (IS_PERFORMANCE_TEST) - set_tests_properties("${TEST_NAME}" PROPERTIES ENVIRONMENT USCXML_BENCHMARK_ITERATIONS=${TEST_BENCHMARK_ITERATIONS}) + if(TEST_ADDED) + set_property(TEST ${TEST_NAME} PROPERTY LABELS ${TEST_NAME}) + set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT ${TEST_TIMEOUT}) + if (IS_PERFORMANCE_TEST) + set_tests_properties("${TEST_NAME}" PROPERTIES ENVIRONMENT USCXML_BENCHMARK_ITERATIONS=${TEST_BENCHMARK_ITERATIONS}) + endif() endif() endif() diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index e20f00d..c5c2bd6 100644 --- a/test/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in @@ -13,6 +13,8 @@ # "w3c/test415.scxml" # "w3c/test513.txt" +# some manual tests are removed in test/CMakeLists.txt already! + # null datamodel # "test436.scxml" diff --git a/test/issues/test-issue86.scxml b/test/issues/test-issue86.scxml new file mode 100644 index 0000000..a978d4b --- /dev/null +++ b/test/issues/test-issue86.scxml @@ -0,0 +1,36 @@ +<scxml datamodel="lua" initial="Start" name="Root" version="1.0" xmlns="http://www.w3.org/2005/07/scxml"> + <state id="Start"> + <invoke id="ID_DATA_ISSUE"> + <content> + <scxml datamodel="lua" initial="StateShape1" name="ScxmlShape1" version="1.0" xmlns="http://www.w3.org/2005/07/scxml"> + <datamodel> + <data id="Timestamp">{ + iSec = 1 +} + </data> + </datamodel> + <final id="pass"/> + <final id="fail"> + <onentry> + <send event="error.execution" target="#_parent"/> + </onentry> + </final> + <state id="StateShape1"> + <onentry> + <script>print(Timestamp) +print(Timestamp.iSec) + </script> + <send delayexpr="tostring(Timestamp.iSec) .. 's'" event="step_1"/> + </onentry> + <transition event="step_1" target="pass"/> + <transition event="error.*" target="fail"/> + </state> + </scxml> + </content> + </invoke> + <transition event="done.invoke.ID_DATA_ISSUE" target="pass"/> + <transition event="error.*" target="fail"/> + </state> + <final id="pass"/> + <final id="fail"/> +</scxml>
\ No newline at end of file diff --git a/test/src/test-gen-c.cpp b/test/src/test-gen-c.cpp index 7870578..48c99e8 100644 --- a/test/src/test-gen-c.cpp +++ b/test/src/test-gen-c.cpp @@ -17,7 +17,8 @@ #endif #ifndef AUTOINCLUDE_TEST -#include "test-c-machine.scxml.c" +//#include "test-c-machine.scxml.c" +#include "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/test/gen/c/ecma/test329.scxml.machine.c" #endif #include "uscxml/util/URL.h" @@ -127,7 +128,7 @@ public: } else if (param->location != NULL) { identifier = param->location; } - invokeData[identifier] = parentMachine->dataModel.getAsData(param->expr); + invokeData[identifier] = parentMachine->dataModel.evalAsData(param->expr); param++; } } @@ -146,7 +147,7 @@ public: break; std::string identifier = std::string(aPtr, cPtr - aPtr); - invokeData[identifier] = parentMachine->dataModel.getAsData(identifier); + invokeData[identifier] = parentMachine->dataModel.evalAsData(identifier); } } } @@ -555,7 +556,7 @@ public: // Data d = USER_DATA(ctx)->dataModel.getStringAsData(expr); if (assign->expr != NULL) { USER_DATA(ctx)->dataModel.assign(key, - USER_DATA(ctx)->dataModel.evalAsData(assign->expr)); + USER_DATA(ctx)->dataModel.getAsData(assign->expr)); } else if (assign->content != NULL) { Data d = Data(assign->content, Data::INTERPRETED); USER_DATA(ctx)->dataModel.assign(key, d); diff --git a/test/src/test-stress.cpp b/test/src/test-stress.cpp index 588e0f7..8bd2e4a 100644 --- a/test/src/test-stress.cpp +++ b/test/src/test-stress.cpp @@ -97,10 +97,9 @@ int main(int argc, char** argv) { entryIter++; // forever - if (entryIter == entries.end()) { - entryIter = entries.begin(); - std::this_thread::sleep_for(std::chrono::seconds(10)); - } +// if (entryIter == entries.end()) { +// entryIter = entries.begin(); +// } } delete watcher; |