|
|
(30 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| == Overview ==
| | #REDIRECT [[STRIDE Off-Target Environment]] |
| [[image:STRIDE_Sandbox_Configuration.jpg|thumb|The sandbox configuration puts both host and target code on the host PC]]
| |
| Two of the largest barriers to embedded developer productivity are long build/test cycles and scarce target hardware. Fortunately, STRIDE's cross-platform capabilities make it possible to run STRIDE in a host-only "sandbox" that emulates your target system for purposes of evaluation. All of the supplied samples and test code run identically under either the sandbox environment or your actual target. In addition, Any test code you write will also run in either environment.
| |
| | |
| The sandbox utilizes a "target" application that is built and runs on the host system. The test runner application runs on the same system and communicates with the "target" process over a TCP/IP connection. This set up frees you from external hardware dependencies and provides for rapid build/run cycles.
| |
| | |
| This article guides you through the steps to run and publish a set of sample tests using the sandbox evaluation environment.
| |
| | |
| == Evaluation Steps ==
| |
| To simplify the evaluation, we recommend using a single Windows or Linux (x86) computer for both the target and host systems. Host and target code will run in separate processes and communicate via TCP/IP, thus simulating an embedded target with host computer configuration. All code and techniques used in the sandbox evaluation are directly transferable to a production environment.
| |
| | |
| The recommended evaluation steps are as follows:
| |
| # Review the STRIDE Overview | |
| # Install required packages
| |
| # Activate your STRIDE license
| |
| # Configure [[STRIDE Test Space]] for publishing results
| |
| # Build and test the basic TargetApp with built-in S2 diagnostic tests, publishing results to TestSpace
| |
| # Build and test the TargetApp with the TestIntro sample, publishing results to TestSpace
| |
| # Create your own test, run and publish
| |
| # Explore other sample tests
| |
| | |
| == Installing Packages ==
| |
| The following packages must be installed on the computer you will use for your sandbox environment. (Use Windows or Linux packages as appropriate).
| |
| | |
| See [[Package Installation]] for instructions.
| |
| | |
| * STRIDE SDK
| |
| * Host Tools
| |
| * Samples
| |
| * Build Tools
| |
| | |
| == TestSpace Configuration ==
| |
| | |
| | |
| == Building the TestApp ==
| |
| This step builds the first version of an instrumented target application. This application links with the STRIDE runtime library and includes the S2 diagnostic tests.
| |
| | |
| This step requires an installation of the STRIDE build tools. If not installed, please see [[Package_Installation#Build_Tools|Package Installation]] for more information.
| |
| | |
| ===Linux===
| |
| <ol>
| |
| <li>Build the test app
| |
| <source lang="bash">
| |
| cd ~/stride/SDK/Linux/src
| |
| make testapp
| |
| </source>
| |
| </li>
| |
| <li>The file <tt>~/stride/SDK/Linux/out/bin/TestApp</tt> will be produced
| |
| </li>
| |
| <li>Note also that the STRIDE database file <tt>~/stride/SDK/Linux/out/TestApp.sidb</tt> is also produced
| |
| </li>
| |
| </ol>
| |
|
| |
| ===Windows===
| |
| <ol>
| |
| <li>If using Microsoft Visual Studio, open a Visual Studio command prompt to ensure that the compiler and linker are on your PATH.
| |
| </li>
| |
| <li>Build the test app using the supplied GNU make. (You will get Makefile errors if you use the default make.)
| |
| <source lang="dos">
| |
| cd stride\SDK\Windows\src
| |
| ..\bin\make testapp
| |
| </source>
| |
| </li>
| |
| <li>The file <tt>stride\SDK\Windows\out\bin\TestApp.exe</tt> will be produced
| |
| </li>
| |
| <li>Note that the STRIDE database file <tt>stride\SDK\Windows\out\TestApp.sidb</tt> is also produced
| |
| </li>
| |
| </ol>
| |
| | |
| == Running the S2 Diagnostic Tests ==
| |
| In this step, we will use the stride executable to run the S2 [[STRIDE_Diagnostic_Tests|diagnostic tests]].
| |
| | |
| <dhflashplayer>file=RunningDiagnostics.mp4|width=640|height=535| path=http://www.s2technologies.com/video/wiki/</dhflashplayer>
| |
| | |
| This step requires an installation of the STRIDE host tools. If not installed, please see [[Package_Installation#Host_Tools|Package Installation]] for more information.
| |
| <ol>
| |
| <li>Invoke the TestApp. In order to see TestApp's output, we recommend that you manually open a new console (or Windows equivalent):
| |
| <source lang="bash">
| |
| ~/stride/SDK/Linux/out/bin/TestApp
| |
| </source>
| |
| <li> Note TestApp's output upon startup.
| |
| <pre>
| |
| starting up...
| |
| "_srThread" thread started.
| |
| "stride" thread started.
| |
| Listening on TCP port 8000
| |
| </pre>
| |
| </li>
| |
| <li>From a console window, invoke <tt>[[STRIDE_Runner|stride]]</tt> as follows, to verify connectivity with the target app (or Windows equivalent):
| |
| <br/>''Note: if this is the first time stride has been run on this computer, you will be prompted for a license activation key. If you access the Internet via a proxy see the information [[STRIDE_Runner#Using_a_Proxy|here]]''.
| |
| <source lang="bash">
| |
| stride --diagnostics --database=~/stride/SDK/Linux/out/TestApp.sidb --device=TCP:localhost:8000
| |
| </source>
| |
| | |
| As the tests run you will see output in both the TestApp (target) and stride (host) windows.
| |
| | |
| The host window output is shown here:
| |
| <pre>
| |
| Loading database...
| |
| Connecting to device...
| |
| runtime version: 4.1.01
| |
| Diagnosing target application...
| |
| link
| |
| payload fragmentation
| |
| runtime configuration
| |
| stub-proxy deadlock
| |
| target characteristics
| |
| ---------------------------------------------------------------------
| |
| Summary: 52 passed, 0 failed, 0 in progress, 12 not in use.
| |
| | |
| Disconnecting from device...
| |
| Saving result file...
| |
| </pre>
| |
| </li>
| |
| <li>Note the Summary results shown in the host output; all in use tests should pass.
| |
| </li>
| |
| <li>To exit TestApp, give the target window focus and enter ctrl-c (or 'q' under Windows).
| |
| </ol>
| |
| | |
| ==== Viewing Detailed Test Results ====
| |
| If you now list the files in the directory from which you ran stride, you will see the files TestApp.xml and--if you were connected to the Internet when you ran the tests--TestApp.xsl.
| |
| | |
| By opening TestApp.xml in a web browser, the xsl is automatically applied to create html in the browser.
| |
| | |
| Details regarding individual diagnostic tests can be found at [[STRIDE_Diagnostic_Tests|this link]].
| |
| | |
| == Building the TargetApp to Include Test Intro Sample ==
| |
| In this step, will will add a set of sample tests that provide an overview of STRIDE testing techniques. The [[Test Intro Sample]] tests are described in the linked article.
| |
| | |
| This step requires an installation of the STRIDE Samples package. If not installed, please see [[Package_Installation#Samples|Package Installation]] for more information.
| |
| | |
| The SDK Makefile is set up so that all .c .cpp and .h files found in the directory <tt>SDK/Linux/sample_src</tt> (or, alternatively <tt>SDK\Windows\sample_src</tt>) are included in the compile and link of the '''testapp''' target.
| |
| | |
| Further--as a pre-compilation step--any .h files found in <tt>sample_src</tt> are submitted to the [[s2scompile|S2 compiler]] and subsequent [[Build Tools]]. This will result in
| |
| * the detection of [[SCL Pragmas#Test_Units| SCL Pragmas]] which declare Test Units in these .h files
| |
| * the inclusion of metadata into the sidb file to describe these Test Units
| |
| * the generation of test harnessing code to run the indicated Test Units and collect results
| |
| | |
| To begin, be sure that TestApp is not running, then copy the .c and .h files found in <tt>Samples/TestIntro</tt> to <tt>SDK/Linux/sample_src</tt> (or Windows equivalent). Then [[#Building_the_TestApp|build the TestApp]] as described above.
| |
| | |
| == Listing Test Units in the Database File ==
| |
| In this step, we will use stride to list the Test Units in the <tt>TestApp.sidb</tt> database.
| |
| | |
| Run stride as follows (or Windows equivalent):
| |
| <source lang="bash">
| |
| stride --list --database=~/stride/SDK/Linux/out/TestApp.sidb
| |
| </source>
| |
| | |
| You should see output like this:
| |
| | |
| <pre>
| |
| Loading database...
| |
| s2_testintro_cclass
| |
| s2_testintro_flist
| |
| s2_testintro_testdoubles
| |
| s2_testintro_testpoints
| |
| </pre>
| |
| | |
| Note that the S2 diagnostic tests (which are present in this TestApp) are not listed.
| |
| | |
| == Running Test Intro Samples ==
| |
| | |
| === Running All Tests ===
| |
| Here we will run all tests in the <tt>TestApp.sidb</tt> database.<ref>Note that the S2 diagnostic tests are treated separately, and are not run unless the <tt>--diagnostics</tt> option is specified to <tt>stride</tt>.</ref>
| |
| | |
| # Invoke TestApp in a target console as in earlier steps.
| |
| # Invoke <tt>stride</tt> as shown below and verify Summary results.
| |
| | |
| <source lang="bash">
| |
| stride --database=~/stride/SDK/Linux/out/TestApp.sidb --device=TCP:localhost:8000
| |
| </source>
| |
| <pre>
| |
| Loading database...
| |
| Connecting to device...
| |
| runtime version: 4.1.01
| |
| Executing test units...
| |
| s2_testintro_cclass
| |
| > 1 passed, 1 failed, 0 in progress, 0 not in use.
| |
| s2_testintro_flist
| |
| > 2 passed, 1 failed, 0 in progress, 0 not in use.
| |
| s2_testintro_testdoubles
| |
| > 3 passed, 0 failed, 0 in progress, 0 not in use.
| |
| s2_testintro_testpoints
| |
| > 3 passed, 0 failed, 0 in progress, 0 not in use.
| |
| ---------------------------------------------------------------------
| |
| Summary: 9 passed, 2 failed, 0 in progress, 0 not in use.
| |
| | |
| Disconnecting from device...
| |
| Saving result file...
| |
| </pre>
| |
| | |
| === Running a Subset of Tests ===
| |
| Here we will run only the Test Units named <tt>s2_testintro_cclass</tt> and <tt>s2_testintro_flist</tt> against TestApp.
| |
| | |
| <source lang="bash">
| |
| stride -r "s2_testintro_cclass, s2_testintro_flist" --database=~/stride/SDK/Linux/out/TestApp.sidb --device=TCP:localhost:8000
| |
| </source>
| |
| <pre>
| |
| Loading database...
| |
| Connecting to device...
| |
| runtime version: 4.1.01
| |
| Executing test units...
| |
| s2_testintro_cclass
| |
| > 1 passed, 1 failed, 0 in progress, 0 not in use.
| |
| s2_testintro_flist
| |
| > 2 passed, 1 failed, 0 in progress, 0 not in use.
| |
| ---------------------------------------------------------------------
| |
| Summary: 3 passed, 2 failed, 0 in progress, 0 not in use.
| |
| | |
| Disconnecting from device...
| |
| Saving result file...
| |
| </pre>
| |
| | |
| == Additional Samples ==
| |
| Additional samples are included in the STRIDE Samples package. (See [[Package_Installation#Samples|Package Installation]] for installation information.)
| |
| | |
| These samples explore each of the techniques outlined in the Test Intro sample in greater depth. See [[Test Unit Samples]] for details.
| |
| | |
| To include any of the samples into your TestApp, just copy the sources into the <tt>sample_src</tt> and rebuild. To execute the tests, use the stride test runner as before.
| |
| | |
| == Related Links ==
| |
| * [[:Category:SDKs|Platform SDKs]]
| |
| * [[Build Tools|STRIDE Build Tools]]
| |
| * [[Test Units|STRIDE Test Units]]
| |
| * [[SCL Pragmas|SCL Pragmas]]
| |
| * [[Test Unit Samples|Test Unit Samples]]
| |
| * [[Stride Runner|STRIDE Test Runner]]
| |
| | |
| == Notes ==
| |
| <references/>
| |
| [[Category:Deployment]]
| |
| [[Category:SDKs]]
| |