For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart: Add C++ Agent to AUT

Quickstart: Adding the C++ Agent to an Application

This page is meant as a quick reference only. You can find important details for each of these steps at Coverage Listener Mode (Application Under Test)

1

Download the Agent

See: Downloading the C++ Agent

2

C++ Agent Configuration and BSID Generation

Base Command: ./SL.Agent.Cpp config [options]

Example Configurations:

Example 1: Using parameters as CLI flags

./SL.Agent.Cpp config \
  --token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  --appName="shopping-cart-service" \
  --branchName="feature-checkout" \
  --buildName="v1.2.3-build-456" \
  --labId="shoppingcart.dev.qa-blue" \
  --include="<source_folder_path>"

Example 2: Using environment variables

export SL_APPNAME="shopping-cart-service"
export SL_BRANCHNAME="feature-checkout"
export SL_BUILDNAME="v1.2.3-build-456"
export SL_LABID="shoppingcart.dev.qa-blue"
export SL_INCLUDE="<source_folder_path>"

./SL.Agent.Cpp config

Example 3: Using settings.json configuration file

{
    "general": {
        "command": "run",
        "appName": "shopping-cart-service",
        "branchName": "feature-checkout",
        "buildName": "v1.2.3-build-456"
    },
    "session":{
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "LabId": "shoppingcart.dev.qa-blue"
    },
    "scan": {
        "binDir": "bin",
        "include": [
            "src/*.cpp,include/*.h,main.cpp"
        ]
    }
}
3

Scan and Instrument the Application Code

Base Command: ./SL.Agent.Cpp scan

Minimum Required Parameters for this command:

  • --token or --tokenFile - Your SeaLights authentication token or path to token file

  • --buildSessionIdFile - Path to the buildSessionId.txt file generated by the ./SL.Agent.Cpp config command

  • --binDir - Path to the directory with .gcno files generated during compilation

  • --include - Comma-separated list of files or patterns to include for scanning. Examples, --include="src/*.cpp,include/*.h,main.cpp" and --inlude="*Core.cpp,mySrc.c??,Api*Client.cpp"

4

Run Unit Tests (Optional)

If you have unit tests, run them now using your normal test commands.

5

Deploy the Instrumented Application Code

Base Command: LD_PRELOAD=<path_to_cpp_agent>/<corresponding_tracer_library> ./<your_application>

Platform
Tracer Library

Linux x86-64

libSL.Cpp.TracerLib.Linux_x64.so

Linux x86

libSL.Cpp.TracerLib.Linux_x86.so

Linux ARMv7

libSL.Cpp.TracerLib.Linux_armv7.so

Linux ARM64

libSL.Cpp.TracerLib.Linux_arm64.so

Last updated

Was this helpful?