diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-08-01 21:47:10 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-08-01 21:47:10 (GMT) |
commit | 045bde78c0587316e0373c7698413412d0f315f9 (patch) | |
tree | f90d4ceb9d48fdc0dc240fce031dc81308e471dd /test | |
parent | e0a7e43e2e41639bb50127cc5419b712a7b1f6e2 (diff) | |
download | uscxml-045bde78c0587316e0373c7698413412d0f315f9.zip uscxml-045bde78c0587316e0373c7698413412d0f315f9.tar.gz uscxml-045bde78c0587316e0373c7698413412d0f315f9.tar.bz2 |
Reenabled V8, Debugger tests and smaller fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | test/ctest/CTestCustom.ctest.in | 12 | ||||
-rw-r--r-- | test/src/test-gen-c.cpp | 14 | ||||
-rwxr-xr-x | test/src/test-http-debugger.pl | 299 | ||||
-rw-r--r-- | test/src/test-http-debugger.scxml | 16 | ||||
-rw-r--r-- | test/src/test-lifecycle.cpp | 1 | ||||
-rw-r--r-- | test/src/test-performance.cpp | 1 | ||||
-rw-r--r-- | test/src/test-promela-parser.cpp | 12 | ||||
-rw-r--r-- | test/src/test-stress.cpp | 9 | ||||
-rw-r--r-- | test/src/test-validating.cpp | 7 | ||||
-rw-r--r-- | test/w3c/confPromela.xsl | 2 | ||||
-rw-r--r-- | test/w3c/promela/test310.scxml | 2 | ||||
-rw-r--r-- | test/w3c/promela/test411.scxml | 2 | ||||
-rw-r--r-- | test/w3c/promela/test413.scxml | 4 |
14 files changed, 338 insertions, 46 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 89962f9..614c85c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -72,6 +72,7 @@ endif() if (NOT BUILD_AS_PLUGINS) USCXML_TEST_COMPILE( + BUILD_ONLY NAME test-serialization LABEL general/test-serialization FILES src/test-serialization.cpp ../contrib/src/uscxml/PausableDelayedEventQueue.cpp @@ -171,7 +172,7 @@ else() if (${WITH_DM_ECMA_V8}) list (APPEND TEST_GEN_C_DEFINITIONS "WITH_DM_ECMA_V8") - list (APPEND TEST_GEN_C_FILES ${PROJECT_SOURCE_DIR}/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp) + list (APPEND TEST_GEN_C_FILES ${PROJECT_SOURCE_DIR}/src/uscxml/plugins/datamodel/ecmascript/v8/${V8_VERSION}/V8DataModel.cpp) list (APPEND TEST_GEN_C_LIBRARIES ${V8_LIBRARY}) endif() if (${WITH_DM_ECMA_JSC}) diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index d6a5884..0dca21e 100644 --- a/test/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in @@ -34,7 +34,11 @@ set(CTEST_CUSTOM_TESTS_IGNORE "w3c/ecma/test301.scxml" # Invalid script URL - PASSED "w3c/ecma/test436.scxml" # Tests NULL datamodel - PASSED + "w3c/namespace/test178.scxml" # Manual - PASSED + "w3c/namespace/test230.scxml" # Manual - PASSED + "w3c/namespace/test250.scxml" # Manual - PASSED "w3c/namespace/test301.scxml" # Invalid script URL - PASSED + "w3c/namespace/test415.scxml" # Manual - PASSED ### Just ignore the XPath datamodel tests that hang, most of the rest fails as well @@ -81,17 +85,21 @@ set(CTEST_CUSTOM_TESTS_IGNORE "w3c/promela/test178.scxml" # two identical params in _event.raw - FAILED "w3c/promela/test230.scxml" # autoforwarded events are identical - PASSED "w3c/promela/test250.scxml" # no onexit in cancelled invoker - PASSED + "w3c/promela/test302.scxml" # variable definition / declaration in script - NOT SUPPORTED + "w3c/promela/test304.scxml" # variable definition / declaration in script - NOT SUPPORTED "w3c/promela/test307.scxml" # late data-binding - PASSED "w3c/promela/test313.scxml" # Manual - PASSED - "w3c/promela/test314.scxml" # Manual - PASSED + "w3c/promela/test314.scxml" # Manual - PASSED + "w3c/promela/test350.scxml" # String concatenation - NOT SUPPORTED "w3c/promela/test415.scxml" # terminate on toplevel final - PASSED + "w3c/promela/test525.scxml" # shallow copy in foreach, test not expressible as such # "w3c/promela/test513.txt" # manual test - PASSED "w3c/promela/test301.scxml" # reject invalid script - PASSED "w3c/promela/test436.scxml" # Tests NULL datamodel - PASSED - # "w3c/promela/test190.scxml" # string concatenation + "w3c/promela/test190.scxml" # string concatenation "w3c/promela/test224.scxml" # string operation startWith # "w3c/promela/test280.scxml" # no runtime checks for undeclared variables # "w3c/promela/test350.scxml" # string concatenation diff --git a/test/src/test-gen-c.cpp b/test/src/test-gen-c.cpp index 0f83da3..4d5514d 100644 --- a/test/src/test-gen-c.cpp +++ b/test/src/test-gen-c.cpp @@ -21,25 +21,25 @@ #ifndef AUTOINCLUDE_TEST #include "test-c-machine.scxml.c" -//#include "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/test/gen/c/lua/test192.scxml.machine.c" +//#include "/Users/sradomski/Documents/TK/Code/uscxml/build/cli-debug/test/gen/c/ecma/test-enc-ISO-8859-1.scxml.machine.c" #endif -//#include "uscxml/util/URL.h" -//#include "uscxml/concurrency/Timer.h" -//#include "uscxml/dom/DOMUtils.h" #include "uscxml/plugins/Factory.h" #include "uscxml/plugins/IOProcessorImpl.h" #include "uscxml/plugins/InvokerImpl.h" -//#include "uscxml/Interpreter.h" #include "uscxml/util/UUID.h" -//#include "uscxml/server/HTTPServer.h" //#include "uscxml/plugins/invoker/dirmon/DirMonInvoker.h" #include "uscxml/plugins/datamodel/promela/PromelaDataModel.h" #ifdef FEATS_ON_CMD #ifdef WITH_DM_ECMA_V8 -#include "uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h" +# if (V8_VERSION == 032317) +# include "uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.h" +# endif +# if (V8_VERSION == 031405) +# include "uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.h" +# endif #endif #ifdef WITH_DM_ECMA_JSC #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h" diff --git a/test/src/test-http-debugger.pl b/test/src/test-http-debugger.pl index fcc675f..4a28a52 100755 --- a/test/src/test-http-debugger.pl +++ b/test/src/test-http-debugger.pl @@ -9,10 +9,11 @@ use JSON qw(from_json to_json); use LWP; use HTTP::Request::Common qw(POST GET); use Data::Dumper; +use Term::ANSIColor 4.00 qw(RESET :constants); -my $scxmlBin = abs_path(shift); +my $scxmlBin = shift; die ("First argument needs to be path to uscxml-browser binary") if (!$scxmlBin); -die("'" . $scxmlBin . "' is not an executable file") if (! -x $scxmlBin); +die("'" . $scxmlBin . "' is not an executable file") if (! -x $scxmlBin || ! -f $scxmlBin); my $baseDir = File::Spec->canonpath(dirname($0)); chdir $baseDir; @@ -25,44 +26,103 @@ my @breakpointSeq; my $pid = fork; +# child process to run the interpreter if (!$pid) { - exec("$scxmlBin -t4088 -d"); + open STDOUT, ">", "/dev/null" or die "$0: open: $!"; + open STDERR, ">&", \*STDOUT or exit 1; + exec("$scxmlBin -t4088 -d test-http-debugger.scxml"); exit; } my $baseURL = 'http://localhost:4088/debug'; # my $baseURL = 'http://localhost:5080/debug'; +sleep(1); + +sub dumpRequest { + # http://search.cpan.org/~oalders/HTTP-Message-6.13/lib/HTTP/Request.pm + my $request = shift; + return + "\tURI: " . $request->uri() . "\n" . + "\tCONTENT: " . $request->content() . "\n"; +} + +sub dumpResponse { + # http://search.cpan.org/~oalders/HTTP-Message-6.13/lib/HTTP/Response.pm + my $response = shift; + return + "\tCONTENT: " . $response->content() . "\n"; +} sub assertSuccess { my $response = shift; my $message = shift; - print "-----\n"; - print $response->content(); - print "-----\n"; from_json($response->content())->{'status'} eq "success" or die($message); } -sub prepareSession { - my $xml = shift; +sub attachSession { + my $docName = shift; + + $request = POST $baseURL.'/instances'; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not get running sessions"); + + my $attach = ""; + my $sessions = from_json($response->content())->{'instances'}; + foreach my $instance (@{$sessions}) { + if ($instance->{'name'} eq $docName) { + $attach = $instance->{'id'}; + last; + } + } + $attach or die("Could not attach to instance named $docName\n"); ### Get a session my $request = GET $baseURL.'/connect'; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not connect"); my $session = from_json($response->content())->{'session'}; die("Cannot acquire session from server") if (!$session); - ### Prepare an SCXML interpreter - $request = POST $baseURL.'/prepare', + $request = POST $baseURL.'/attach', [ + 'attach' => $attach, 'session' => $session, - 'url' => 'http://localhost/anonymous.scxml', - 'xml' => $xml ]; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not get attach to session"); + print BOLD BLACK . "Session attached!" . RESET . "\n\n"; + return $session; +} + +sub prepareSession { + my $source = shift; + + ### Get a session + my $request = GET $baseURL.'/connect'; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not connect"); + + my $session = from_json($response->content())->{'session'}; + die("Cannot acquire session from server") if (!$session); + + $source->{'session'} = $session; + + ### Prepare an SCXML interpreter + $request = POST $baseURL.'/prepare', $source; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not prepare SCXML"); - + print BOLD BLACK . "Session prepared!" . RESET . "\n\n"; return $session; } @@ -74,8 +134,11 @@ sub finishSession { [ 'session' => $session, ]; + print FAINT RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print FAINT CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not disconnect session"); + print BOLD BLACK . "Session terminated!" . RESET . "\n\n"; } sub popAndCompare { @@ -88,11 +151,15 @@ sub popAndCompare { die("Expected different breakpoint"); } } - print "SUCCESS\n"; + print BOLD BLACK . "OK!" . RESET . "\n\n"; } sub testSimpleStepping { + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testSimpleStepping " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + my $xml = << 'END_SCXML'; <scxml> <state id='s1'> @@ -111,10 +178,10 @@ END_SCXML @breakpointSeq = ( { subject => "microstep", when => "before" }, { subject => "state", when => "before", action => "enter" }, - { subject => "state", when => "after", action => "enter" }, + { subject => "state", when => "after", action => "enter" }, { subject => "state", when => "before", action => "enter", stateId => "s1" }, { subject => "executable", when => "before", execName => "log" }, - { subject => "executable", when => "after", execName => "log" }, + { subject => "executable", when => "after", execName => "log" }, { subject => "state", when => "after", action => "enter", stateId => "s1" }, { subject => "microstep", when => "after" }, { subject => "microstep", when => "before" }, @@ -136,18 +203,24 @@ END_SCXML ); - my $session = &prepareSession($xml); + my $session = &prepareSession({'xml' => $xml}); + print BOLD . "Testing sequence of breakpoints being raised via step". RESET . "\n"; + while(@breakpointSeq > 0) { ### Take a step $request = POST $baseURL.'/step', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not step"); # this will cause the interpreter to pause execution ### Get the pending messages $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not get breakpoint after step"); # compare to what we expect @@ -157,12 +230,16 @@ END_SCXML ### last step will finalize the interpreter $request = POST $baseURL.'/step', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not get breakpoint after step"); ### get the pending server push reply $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not get breakpoint after step"); $data = from_json($response->content()); @@ -172,6 +249,11 @@ END_SCXML } sub testBreakpoint { + + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testBreakpoint " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + my $xml = << 'END_SCXML'; <scxml> <state id='s1'> @@ -187,10 +269,11 @@ sub testBreakpoint { </scxml> END_SCXML - my $session = prepareSession($xml); + my $session = &prepareSession({'xml' => $xml}); - ### Skip to breakpoint - $request = POST $baseURL.'/breakpoint/skipto', + print BOLD . "Adding a dedicated breakpoint". RESET . "\n"; + + $request = POST $baseURL.'/breakpoint/add', [ 'session' => $session, 'when' => 'after', @@ -198,12 +281,46 @@ END_SCXML 'subject' => 'state', 'stateId' => 's1' ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not add breakpoint"); - - ### get the pending server push reply + + print BOLD . "Starting interpretation (will run into breakpoint)". RESET . "\n"; + + $request = POST $baseURL.'/start', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not add breakpoint"); + + print BOLD . "Polling asynchronously for breakpoint hit by interpreter". RESET . "\n"; + + $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not poll for breakpoint"); + + print BOLD . "Skipping to implicit breakpoint". RESET . "\n"; + $request = POST $baseURL.'/breakpoint/skipto', + [ + 'session' => $session, + 'when' => 'before', + 'action' => 'enter', + 'subject' => 'state', + 'stateId' => 's2' + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not add breakpoint"); + + print BOLD . "Polling asynchronously for breakpoint hit by interpreter". RESET . "\n"; $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not get breakpoint after step"); $data = from_json($response->content()); @@ -213,6 +330,11 @@ END_SCXML } sub testIssueReporting { + + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testIssueReporting " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + my $xml = << 'END_SCXML'; <scxml> <state id='s1'> @@ -233,14 +355,18 @@ sub testIssueReporting { </scxml> END_SCXML - my $session = prepareSession($xml); + my $session = prepareSession({'xml' => $xml}); + print BOLD . "Getting a list of issues with the document". RESET . "\n"; + ### Get a list of issues $request = POST $baseURL.'/issues', [ 'session' => $session ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; assertSuccess($response, "Could not get issues for prepared SCXML document"); $data = from_json($response->content()); @@ -250,8 +376,135 @@ END_SCXML } +sub testDataModelInspection { + + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testDataModelInspection " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + + my $session = prepareSession({'url' => 'https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/ecma/test144.scxml'}); + + print BOLD . "Skipping to first transition". RESET . "\n"; + $request = POST $baseURL.'/breakpoint/skipto', + [ + 'session' => $session, + 'when' => 'before', + 'subject' => 'transition', + 'target' => 's1' + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not add breakpoint"); + + print BOLD . "Polling asynchronously for breakpoint hit by interpreter". RESET . "\n"; + $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not get breakpoint after step"); + + + print BOLD . "Evaluating expression '_event' on the datamodel". RESET . "\n"; + $request = POST $baseURL.'/eval', + [ + 'session' => $session, + 'expression' => '_event', + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not evaluate expression"); + + print BOLD . "Evaluating expression '_ioprocessors' on the datamodel". RESET . "\n"; + $request = POST $baseURL.'/eval', + [ + 'session' => $session, + 'expression' => '_ioprocessors', + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not evaluate expression"); + + + &finishSession($session); + +} + +sub testSessionAttaching { + + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testSessionAttaching " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + + my $session = attachSession("test-http-debugger.scxml"); + + print BOLD . "Skipping to first transition". RESET . "\n"; + $request = POST $baseURL.'/breakpoint/skipto', + [ + 'session' => $session, + 'when' => 'before', + 'subject' => 'transition', + 'target' => 's1' + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not add breakpoint"); + + print BOLD . "Polling asynchronously for breakpoint hit by interpreter". RESET . "\n"; + $request = POST $baseURL.'/poll', ['session' => $session]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not get breakpoint after step"); + + &finishSession($session); + +} + +sub testEventInsertion { + + print BOLD WHITE ON_RED . " " . RESET ."\n"; + print BOLD WHITE ON_RED . " testEventInsertion " . RESET ."\n"; + print BOLD WHITE ON_RED . " " . RESET ."\n\n"; + + my $xml = << 'END_SCXML'; + <scxml> + <state id='s1'> + <onentry> + <log label="'foo'" /> + </onentry> + <transition target='pass' event='bar' /> + </state> + <final id='pass' /> + </scxml> +END_SCXML + + my $session = prepareSession({'xml' => $xml}); + + print BOLD . "Sending event" . RESET . "\n"; + $request = POST $baseURL.'/event', + [ + 'session' => $session, + 'name' => 'foo', + ]; + print RED . "-> SEND === line:" . __LINE__ . "\n" . dumpRequest($request) . RESET . "\n"; + $response = $ua->request($request); + print CYAN . "<- RCVD === line:" . __LINE__ . "\n" . dumpResponse($response) . RESET . "\n"; + assertSuccess($response, "Could not send event"); + + &finishSession($session); + +} + &testSimpleStepping(); &testBreakpoint(); &testIssueReporting(); +&testDataModelInspection(); +&testSessionAttaching(); +&testEventInsertion(); + kill('TERM', $pid);
\ No newline at end of file diff --git a/test/src/test-http-debugger.scxml b/test/src/test-http-debugger.scxml new file mode 100644 index 0000000..842390d --- /dev/null +++ b/test/src/test-http-debugger.scxml @@ -0,0 +1,16 @@ +<scxml datamodel="ecmascript" version="1.0" > + <state id="s0"> + <onentry> + <send event="foo" delay="1s" /> + <log expr="'tick'" /> + </onentry> + <transition event="foo" target="s1" /> + </state> + <state id="s1"> + <onentry> + <send event="foo" delay="1s" /> + <log expr="'tock'" /> + </onentry> + <transition event="foo" target="s0" /> + </state> +</scxml>
\ No newline at end of file diff --git a/test/src/test-lifecycle.cpp b/test/src/test-lifecycle.cpp index 6b30c96..04c1d27 100644 --- a/test/src/test-lifecycle.cpp +++ b/test/src/test-lifecycle.cpp @@ -341,6 +341,7 @@ int main(int argc, char** argv) { assert(interpreter.getState() == USCXML_INSTANTIATED); assert(interpreter.step() == USCXML_INITIALIZED); assert(interpreter.step() == USCXML_MICROSTEPPED); + assert(interpreter.step() == USCXML_MICROSTEPPED); assert(interpreter.step() == USCXML_MACROSTEPPED); assert(interpreter.step(0) == USCXML_IDLE); assert(interpreter.step() == USCXML_MICROSTEPPED); diff --git a/test/src/test-performance.cpp b/test/src/test-performance.cpp index c312b70..188f4b2 100644 --- a/test/src/test-performance.cpp +++ b/test/src/test-performance.cpp @@ -57,6 +57,7 @@ int main(int argc, char** argv) { start = now; report = start + seconds(1); endTime = start + seconds(10); + std::cout << "\"Init (ms)\", \"Steps/s\"" << std::endl; while(true) { sc.step(); diff --git a/test/src/test-promela-parser.cpp b/test/src/test-promela-parser.cpp index f0a019e..c294e6f 100644 --- a/test/src/test-promela-parser.cpp +++ b/test/src/test-promela-parser.cpp @@ -63,6 +63,7 @@ void testInlinePromela() { } +#if 0 { Interpreter interpreter = Interpreter::fromURL("/Users/sradomski/Documents/TK/Code/uscxml/test/uscxml/promela/test-event-source-auto.scxml"); assert(interpreter); @@ -71,7 +72,7 @@ void testInlinePromela() { assert(inls.getAllOfType(PromelaInline::PROMELA_EVENT_ONLY).size() == 2); assert(inls.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT).size() == 1); } - +#endif #if 0 { std::string test = "\ @@ -309,6 +310,13 @@ void testPromelaParser() { } #endif + { + try { + PromelaParser ast("\"foo"); + assert(false); + } catch(...) { + } + } } int main(int argc, char** argv) { @@ -320,4 +328,4 @@ int main(int argc, char** argv) { testInlinePromela(); testPromelaParser(); -}
\ No newline at end of file +} diff --git a/test/src/test-stress.cpp b/test/src/test-stress.cpp index e034e87..d0c15fd 100644 --- a/test/src/test-stress.cpp +++ b/test/src/test-stress.cpp @@ -80,7 +80,8 @@ int main(int argc, char** argv) { lastTransitionAt = time(NULL); Interpreter interpreter = Interpreter::fromURL(std::string(argv[optind]) + PATH_SEPERATOR + entryIter->first); -// Interpreter interpreter = Interpreter::fromURL("/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/ecma/test422.scxml"); +// Interpreter interpreter = Interpreter::fromURL("/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/ecma/test159.scxml"); + LOGD(USCXML_INFO) << "Processing " << interpreter.getImpl()->getBaseURL() << std::endl; if (interpreter) { @@ -100,9 +101,9 @@ int main(int argc, char** argv) { entryIter++; // forever -// if (entryIter == entries.end()) { -// entryIter = entries.begin(); -// } + if (entryIter == entries.end()) { + entryIter = entries.begin(); + } } delete watcher; diff --git a/test/src/test-validating.cpp b/test/src/test-validating.cpp index a0fd6dd..19897a1 100644 --- a/test/src/test-validating.cpp +++ b/test/src/test-validating.cpp @@ -356,13 +356,16 @@ bool attributeConstraints() { "<scxml>" " <state id=\"start\">" " <onentry>" - " <script src=\"test-validating\"/>" + " <script src=\"https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml\">" + " foo" + " </script>" " </onentry>" " </state>" "</scxml>"; std::set<std::string> issueLocations = issueLocationsForXML(xml); - assert(issueLocations.size() == 0); + assert(issueLocations.find("//state[@id=\"start\"]/onentry[1]/script[1]") != issueLocations.end()); + assert(issueLocations.size() == 1); } diff --git a/test/w3c/confPromela.xsl b/test/w3c/confPromela.xsl index 37920a5..44395d6 100644 --- a/test/w3c/confPromela.xsl +++ b/test/w3c/confPromela.xsl @@ -542,7 +542,7 @@ is the second argument --> </xsl:template> <xsl:template match="//@conf:inState"> - <xsl:attribute name="cond">config[<xsl:value-of select="upper-case(.)"/>]</xsl:attribute> + <xsl:attribute name="cond">config[<xsl:value-of select="."/>]</xsl:attribute> </xsl:template> <!-- returns a value that cannot be converted into a Boolean --> diff --git a/test/w3c/promela/test310.scxml b/test/w3c/promela/test310.scxml index 2428dcd..43d80f0 100644 --- a/test/w3c/promela/test310.scxml +++ b/test/w3c/promela/test310.scxml @@ -3,7 +3,7 @@ <scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="promela" initial="p"> <parallel id="p"> <state id="s0"> - <transition cond="config[S1]" target="pass"/> + <transition cond="config[s1]" target="pass"/> <transition target="fail"/> </state> <state id="s1"/> diff --git a/test/w3c/promela/test411.scxml b/test/w3c/promela/test411.scxml index 317b8c4..4b8da3e 100644 --- a/test/w3c/promela/test411.scxml +++ b/test/w3c/promela/test411.scxml @@ -16,7 +16,7 @@ timeout also indicates failure --> <transition event="event2" target="pass"/> <state id="s01"> <onentry> - <if cond="config[S01]"> + <if cond="config[s01]"> <raise event="event2"/> </if> </onentry> diff --git a/test/w3c/promela/test413.scxml b/test/w3c/promela/test413.scxml index f4c983d..70d5bed 100644 --- a/test/w3c/promela/test413.scxml +++ b/test/w3c/promela/test413.scxml @@ -16,7 +16,7 @@ states we should not enter all have immediate transitions to failure in them --> <transition target="fail"/> </state> <state id="s2p112"> - <transition cond="config[S2P122]" target="pass"/> + <transition cond="config[s2p122]" target="pass"/> </state> </state> <!-- end s2p11 --> @@ -25,7 +25,7 @@ states we should not enter all have immediate transitions to failure in them --> <transition target="fail"/> </state> <state id="s2p122"> - <transition cond="config[S2P112]" target="pass"/> + <transition cond="config[s2p112]" target="pass"/> </state> </state> </parallel> |