Difference between revisions of "Tracing"

From STRIDE Wiki
Jump to: navigation, search
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 --trace_timeout=600 --log_level=all
+
   stride --trace --trace_timeout=600 --log_level=all --database="/my/path/targetApp.sidb" --device=TCP:localhost:8000
  
 
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 it 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 it 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).
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 --trace_timeout=600 --log_level=all --run=MyFunctionCall.pl
+
   stride --run=MyFunctionCall.pl --trace --trace_timeout=600 --log_level=all --database="/my/path/targetApp.sidb" --device=TCP:localhost:8000
 
(assuming you named your script ''MyFunctionCall.pl'')
 
(assuming you named your script ''MyFunctionCall.pl'')
  

Revision as of 17:40, 28 April 2010

Once you have instrumented your source code, you might want to observe the execution process or more specifically 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 --trace --trace_timeout=600 --log_level=all --database="/my/path/targetApp.sidb" --device=TCP:localhost:8000 

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 it 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 --run=MyFunctionCall.pl --trace --trace_timeout=600 --log_level=all --database="/my/path/targetApp.sidb" --device=TCP:localhost:8000 

(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.