Skip to content

Latest commit

 

History

History
392 lines (300 loc) · 10.2 KB

TestUtilityPlugin.md

File metadata and controls

392 lines (300 loc) · 10.2 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 of its configuration, methods and properties provided.

Case Sensitivity

All identifiers on the interface 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
autostart boolean Determines if the plugin is to be started automatically along with the framework

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": 1234567890,
    "method": "TestUtility.1.runmemory",
    "params": {
        "command": "Malloc",
        "size": 0
    }
}

Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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": 1234567890,
    "method": "TestUtility.1.runcrash",
    "params": {
        "command": "Crash",
        "delay": 1,
        "count": 1
    }
}

Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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

Name Type Description
(property) array List of test commands
(property)[#] string Available test commands

Example

Get Request

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

Get Response

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

description property

Provides access to the description of a test command.

This property is read-only.

Value

Name Type Description
(property) object Description of a test command
(property).description string Test command description

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

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": 1234567890,
    "method": "TestUtility.1.description@Malloc"
}

Get Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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

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

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

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": 1234567890,
    "method": "TestUtility.1.parameters@Malloc"
}

Get Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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": 1234567890,
    "method": "TestUtility.1.shutdowntimeout",
    "params": 5000
}

Set Response

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