Skip to content

Latest commit

 

History

History
418 lines (308 loc) · 10.3 KB

TestUtilityPlugin.md

File metadata and controls

418 lines (308 loc) · 10.3 KB

Test Utility Plugin

Version: 1.0

Status: ⚫⚪⚪

TestUtility plugin for Thunder framework.

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the TestUtility plugin. It includes detailed specification about its configuration, methods and properties provided.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

The TestUtility plugin enables to execute embedded test commands on the platform.

The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].

Configuration

The table below lists configuration options of the plugin.

Name Type Description
callsign string Plugin instance name (default: TestUtility)
classname string Class name: TestUtility
locator string Library name: libWPEFrameworkTestUtility.so
startmode string Determines if the plugin shall be started automatically along with the framework

Interfaces

This plugin implements the following interfaces:

Methods

The following methods are provided by the TestUtility plugin:

TestUtility interface methods:

Method Description
runmemory Runs a memory test command
runcrash Runs a crash test command

runmemory method

Runs a memory test command.

Parameters

Name Type Description
params object
params.command string Test command name
params?.size number (optional) The amount of memory in KB for allocation (applicable for Malloc commands)

Result

Name Type Description
result object
result.allocated number Already allocated memory in KB
result.size number Current allocation in KB
result.resident number Resident memory in KB

Errors

Code Message Description
2 ERROR_UNAVAILABLE Unknown category
30 ERROR_BAD_REQUEST Bad JSON param data format

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.runmemory",
  "params": {
    "command": "Malloc",
    "size": 0
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "allocated": 0,
    "size": 0,
    "resident": 0
  }
}

runcrash method

Runs a crash test command.

Parameters

Name Type Description
params object
params.command string Test command name
params?.delay number (optional) Delay (in seconds) before the crash attempt (applicable for Crash command)
params?.count number (optional) How many times a Crash command will be executed consecutively (applicable for CrashNTimes command)

Result

Name Type Description
result null Always null

Errors

Code Message Description
2 ERROR_UNAVAILABLE Unknown category
30 ERROR_BAD_REQUEST Bad JSON param data format

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.runcrash",
  "params": {
    "command": "Crash",
    "delay": 1,
    "count": 1
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

Properties

The following properties are provided by the TestUtility plugin:

TestUtility interface properties:

Property Description
commands RO List of test commands
description RO Description of a test command
parameters RO Parameters of a test command
shutdowntimeout WO Timeout to be waited before deactivating the plugin

commands property

Provides access to the list of test commands.

This property is read-only.

Value

Result

Name Type Description
result array List of test commands
result[#] string Available test commands

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.commands"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    "Malloc"
  ]
}

description property

Provides access to the description of a test command.

This property is read-only.

Value

The command argument shall be passed as the index to the property, e.g. TestUtility.1.description@Malloc.

Result

Name Type Description
result object Description of a test command
result.description string Test command description

Errors

Code Message Description
2 ERROR_UNAVAILABLE Unknown category
30 ERROR_BAD_REQUEST Bad JSON param data format

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.description@Malloc"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "description": "Allocates desired amount of memory (in KB) and holds it"
  }
}

parameters property

Provides access to the parameters of a test command.

This property is read-only.

Value

The command argument shall be passed as the index to the property, e.g. TestUtility.1.parameters@Malloc.

Result

Name Type Description
result object Parameters of a test command
result?.input array (optional)
result?.input[#] object (optional)
result?.input[#].name string Test command input parameter
result?.input[#].type string Test command input parameter type (must be one of the following: Number, String, Boolean, Object, Symbol)
result?.input[#].comment string Test command input parameter description
result.output object
result.output.name string Test command output parameter
result.output.type string Test command output parameter type (must be one of the following: Number, String, Boolean, Object, Symbol)
result.output.comment string Test command output parameter description

Errors

Code Message Description
2 ERROR_UNAVAILABLE Unknown category
30 ERROR_BAD_REQUEST Bad JSON param data format

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.parameters@Malloc"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "input": [
      {
        "name": "memory",
        "type": "Number",
        "comment": "Memory statistics in KB"
      }
    ],
    "output": {
      "name": "memory",
      "type": "Number",
      "comment": "Memory statistics in KB"
    }
  }
}

shutdowntimeout property

Provides access to the timeout to be waited before deactivating the plugin.

This property is write-only.

Value

Name Type Description
(property) number Timeout in milli seconds

Example

Set Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "TestUtility.1.shutdowntimeout",
  "params": 5000
}

Set Response

{
    "jsonrpc": "2.0",
    "id": 42,
    "result": "null"
}