Version: 1.0
Status: ⚫⚪⚪
TestUtility plugin for Thunder framework.
This document describes purpose and functionality of the TestUtility plugin. It includes detailed specification about its configuration, methods and properties provided.
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.
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. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
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].
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 |
This plugin implements the following interfaces:
- TestUtility.json (version 1.0.0) (uncompliant-extended format)
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.
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) |
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 |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.runmemory",
"params": {
"command": "Malloc",
"size": 0
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"allocated": 0,
"size": 0,
"resident": 0
}
}
runcrash method
Runs a crash test command.
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) |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.runcrash",
"params": {
"command": "Crash",
"delay": 1,
"count": 1
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
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.
Name | Type | Description |
---|---|---|
result | array | List of test commands |
result[#] | string | Available test commands |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.commands"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": [
"Malloc"
]
}
description property
Provides access to the description of a test command.
This property is read-only.
The command argument shall be passed as the index to the property, e.g. TestUtility.1.description@Malloc.
Name | Type | Description |
---|---|---|
result | object | Description of a test command |
result.description | string | Test command description |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.description@Malloc"
}
{
"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.
The command argument shall be passed as the index to the property, e.g. TestUtility.1.parameters@Malloc.
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 |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.parameters@Malloc"
}
{
"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.
Name | Type | Description |
---|---|---|
(property) | number | Timeout in milli seconds |
{
"jsonrpc": "2.0",
"id": 42,
"method": "TestUtility.1.shutdowntimeout",
"params": 5000
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}