Tracing: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
The simplest usage model for tracing with the runner is to add the <tt>--trace</tt> flag to your command line runner parameters, for example:
The simplest usage model for tracing with the runner is to add the <tt>--trace</tt> flag to your command line runner parameters, for example:


   stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace
   stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace --trace_timeout=600


This will cause the runner to listen indefinitely for test point and log messages from the target device. When the runner is passively tracing like this, you can terminate the runner by entering '''<tt>ctrl-c</tt>''' in the console window. This mode of tracing works well if your device under test is continuously executing the instrumented code '''or''' if you can manually start the processing on the device (via external input, for example).
This will cause the runner to listen for 600 sec for test point and log messages from the target device. When the runner is passively tracing like this, you can terminate the runner by entering '''<tt>ctrl-c</tt>''' in the console window. This mode of tracing works well if your device under test is continuously executing the instrumented code '''or''' if you can manually start the processing on the device (via external input, for example).


If, however, the source code under test must be initiated by a remote function call (using [[Scl_function|STRIDE remoting]]), then you will need to incorporate the function call into the execution of the runner. The simplest way to accomplish this is to write a simple script to make the remote function call, as shown [[Perl_Script_Snippets#Standalone_two-line_script_for_invoking_a_remote_function|here for perl]].
If, however, the source code under test must be initiated by a remote function call (using [[Scl_function|STRIDE remoting]]), then you will need to incorporate the function call into the execution of the runner. The simplest way to accomplish this is to write a simple script to make the remote function call, as shown [[Perl_Script_Snippets#Standalone_two-line_script_for_invoking_a_remote_function|here for perl]].
Line 11: Line 11:
Once you have written a simple script to invoke your function(s), you can execute it with the runner using:
Once you have written a simple script to invoke your function(s), you can execute it with the runner using:


   stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace --run=MyFunctionCall.pl
   stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace --trace_timeout=600 --run=MyFunctionCall.pl
(assuming you named your script ''MyFunctionCall.pl'')
(assuming you named your script ''MyFunctionCall.pl'')



Revision as of 19:36, 17 February 2010

Once you have instrumented your source code, you might want to verify that STRIDE Test Points are indeed being reported as you expect. One easy way to accomplish this is by using the console trace output feature in the STRIDE Runner.

The simplest usage model for tracing with the runner is to add the --trace flag to your command line runner parameters, for example:

 stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace --trace_timeout=600

This will cause the runner to listen for 600 sec for test point and log messages from the target device. When the runner is passively tracing like this, you can terminate the runner by entering ctrl-c in the console window. This mode of tracing works well if your device under test is continuously executing the instrumented code or if you can manually start the processing on the device (via external input, for example).

If, however, the source code under test must be initiated by a remote function call (using STRIDE remoting), then you will need to incorporate the function call into the execution of the runner. The simplest way to accomplish this is to write a simple script to make the remote function call, as shown here for perl.

Once you have written a simple script to invoke your function(s), you can execute it with the runner using:

 stride --device=TCP:localhost:8000 --database=%STRIDE_DIR%\sdk\windows\out\testapp.sidb --trace --trace_timeout=600 --run=MyFunctionCall.pl

(assuming you named your script MyFunctionCall.pl)

Once you have managed to start the source under test on the device and have connected with the runner, you should see output that looks roughly like:

Loading database...
Connecting to device...
Executing...
  script "c:\s2\MyFunctionCall.pl"
2082576600 POINT "START" [../sample_src/s2_expectations_source.c:62]
2082586700 POINT "IDLE" - 02 00 00 00 [../sample_src/s2_expectations_source.c:77]
2082596700 LOG   "Info" - Idle state entered first time [../sample_src/s2_expectations_source.c:85]
2082596701 POINT "ACTIVE" - 03 00 00 00 [../sample_src/s2_expectations_source.c:100]
2082606800 POINT "ACTIVE Previous State" - IDLE [../sample_src/s2_expectations_source.c:102]
2082616800 POINT "IDLE" - 04 00 00 00 [../sample_src/s2_expectations_source.c:77]
2082626900 POINT "END" - 05 00 00 00 [../sample_src/s2_expectations_source.c:114]
    > 0 passed, 0 failed, 0 in progress, 0 not in use.
  ---------------------------------------------------------------------
  Summary: 0 passed, 0 failed, 0 in progress, 0 not in use.

Disconnecting from device...
Saving result file...

As you can see, any test points or logs that are executed in the source under test will be reported to the console output. This provides a mean to peruse the output of your instrumented source code and do a quick sanity check of your instrumentation.

Tracing within the runner also allows filters to be applied and timeout intervals to be specified - more details can be found in the STRIDE Runner page.