Studio:SCL Samples

From STRIDE Wiki
Jump to navigation Jump to search

Introduction

The following content relates to the sample files and workspaces installed in %STRIDE_DIR%\Samples\SCL. This sample consists of a Visual Studio workspace for building an off-target simulator, sample STRIDE Communication Language (SCL) source code, and a STRIDE workspace for sample code execution.

Getting Started

To begin, open the Visual Studio Solution file in the sample directory. This solution (and corresponding project) were created for Visual Studio 2005. If you have a later version of Visual Studio installed, you should be able to open this solution and it will be automatically upgraded if necessary. If you do not currently have any version of Visual Studio, we recommend that you install the current free version of Visual Studio Express.

Once you have successfully opened the solution, rebuild it. The build process has custom STRIDE build rules integrated and will produce a STRIDE database, intercept module source files, and an off-target simulator application that incorporates the sample source code.

Once the build is complete, perform the following steps to run the sample scripts in the workspace:

  1. launch the off-target simulator, SCL_Samples.exe. This will run in a standard console window.
  2. open a command prompt window and change to this sample's directory.
  3. at the command prompt, run the command WorkspaceRun.pl -x setup -x teardown. This will execute all of the sample test scripts in the workspace and displays the results. You may open a browser and display the report written to the SCL_Samples.html file in the sample's directory .
  4. quit the SCL_Samples.exe application by typing 'q' in its console window.

Sample Tests

Now that you have built the off-target simulator and executed the SCL sample code it contains, you can take time to peruse the sample source and the corresponding results that each produces. The Source Files workspace folder (in the Files' tab) contains the header files that provide examples of SCL usage. This section provides a brief description for each.

Capture

This folder contains header files that demonstrate how to use SCL to identify and define interfaces on the target.

Functions

This folder contains a header file that demonstrates the usage of the scl_func and scl_function SCL pragmas.

Messages

This folder contains a header file that demonstrates the usage of the scl_msg SCL pragma to define several different types of interfaces: one way command, one way response, two way, and broadcast messages.

Qualification=

This folder contains header files that demonstrate how to use SCL to annotate or markup interface payloads for communication with the target.

Casting

This folder contains a header file that demonstrates the usage of the scl_cast pragma. One example shows how to use SCL to cast an integer field to an enumerated type, effectively constraining the values that may be allowed for that field. Another example shows how to use the scl_cast pragma to cast an integer pointer to a pointer to enumerated type, constraining the values that that field may point to.

FunctionCallbacks

This folder contains a header file that demonstrates how to use the scl_ptr_flist pragma to identify functions that may be associated with a function pointer field in a payload. This illustrates a concept where callback functions may be communicated between user and owner. Examples include using a form of the pragma to declare an anonymous function interface (the "default function"), and using the pragma to associate previously captured functions with the function pointer field.

Pointers

Strings

Unions

Values

Test Execution

This sample demonstrates two different techniques for executing the sample test scripts.

Command Line Execution

Command line execution for sample STRIDE test workspace is done using the WorkspaceRun utility. Here is an example of specific syntax to execute a test workspace. All of these commands can be invoked from a standard command shell (or other shell of your choosing) and the arguments shown assume that the commands are executed with the sample's directory as the starting directory. You must have your SCL_Samples.exe application running in order for the runner to be able to initiate a connection to the target simulator.

 WorkspaceRun.pl -x setup -x teardown

When you run this command, you should see console output like:

 Opening workspace C:\S2\Seaside\Samples\SCL/SCL_Samples.ssw..
 excluding folder setup in workspace C:\S2\Seaside\Samples\SCL/SCL_Samples.ssw
 running folder test in workspace C:\S2\Seaside\Samples\SCL/SCL_Samples.ssw
 excluding folder teardown in workspace C:\S2\Seaside\Samples\SCL/SCL_Samples.ssw
 Test results written to C:\S2\Seaside\Samples\SCL\SCL_Samples.html
 ***************************************************************************
 Results Summary
 ***************************************************************************
   Passed:              19
   Failed:               0
   In Progress:          0
   Not Applicable:       0
   ...in 11 suites.
 ***************************************************************************


Workspace-Based Execution

When opened with STRIDE Studio the sample STRIDE workspace (.ssw) a user could manage test order and hierarchy. The setup and teardown folders provide basic infrastructure scripts that start/stop the simulator application (SCL_Samples.exe) and to manage traceviews used for srPrint message collection. The scripts that drive the testing are in the workspace test folder. What follows is a brief description for each.

Capture

This folder contains samples that demonstrate how to use SCL to identify and define interfaces on the target.

Functions

This folder contains a script that demonstrate how to make the IM generated function proxy to call the host.

Qualification

This folder contains samples that demonstrate how to use SCL to annotate or markup interface payloads for communication with the target.

Casting

This folder contains a script that demonstrates

FunctionCallbacks

This folder contains a script that demonstrates

Pointers

This folder contains a script that demonstrates

Strings

This folder contains a script that demonstrates