diff --git a/definitions/CMakeLists.txt b/definitions/CMakeLists.txt index d2a15c56..4cc4daf6 100644 --- a/definitions/CMakeLists.txt +++ b/definitions/CMakeLists.txt @@ -35,11 +35,6 @@ set(WORKING_VARIABLE ${JSONRPC_PATTERNS}) list(TRANSFORM WORKING_VARIABLE PREPEND "${CMAKE_SOURCE_DIR}/jsonrpc/") file(GLOB JSON_FILE ${WORKING_VARIABLE}) -separate_arguments(JSONRPC_PATTERNS) -set(WORKING_VARIABLE ${JSONRPC_PATTERNS}) -list(TRANSFORM WORKING_VARIABLE PREPEND "${CMAKE_SOURCE_DIR}/qa_jsonrpc/") -file(GLOB QA_JSON_FILE ${WORKING_VARIABLE}) - separate_arguments(INTERFACES_PATTERNS) set(WORKING_VARIABLE ${INTERFACES_PATTERNS}) list(TRANSFORM WORKING_VARIABLE PREPEND "${CMAKE_SOURCE_DIR}/interfaces/") diff --git a/qa_interfaces/CMakeLists.txt b/qa_interfaces/CMakeLists.txt index f5589592..547235cd 100644 --- a/qa_interfaces/CMakeLists.txt +++ b/qa_interfaces/CMakeLists.txt @@ -38,9 +38,9 @@ endif() separate_arguments(INTERFACES_PATTERNS) file(GLOB QA_INTERFACES_HEADERS ${INTERFACES_PATTERNS}) -ProxyStubGenerator(NAMESPACE "Thunder::QualityAssurance" INPUT "${QA_INTERFACES_HEADERS}" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/qa_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH}) +ProxyStubGenerator(INPUT "${QA_INTERFACES_HEADERS}" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/qa_generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH}) -list(APPEND QA_INTERFACES_HEADERS Module.h QAIds.h) +list(APPEND QA_INTERFACES_HEADERS Module.h Ids.h) file(GLOB QA_PROXY_STUB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/qa_generated/ProxyStubs*.cpp") add_library(${Target} SHARED diff --git a/qa_interfaces/ITestController.h b/qa_interfaces/ITestController.h index 72797c3f..61d2cb0b 100644 --- a/qa_interfaces/ITestController.h +++ b/qa_interfaces/ITestController.h @@ -20,9 +20,12 @@ #pragma once #include "Module.h" +// @stubgen:include + namespace Thunder { namespace QualityAssurance { + /* @json 1.0.0 */ struct EXTERNAL ITestController : virtual public Core::IUnknown { enum { ID = ID_TESTCONTROLLER }; @@ -69,11 +72,47 @@ namespace Thunder { virtual ITest* Test(const string& name) const = 0; }; + struct TestInfo { + string category; /* @brief Category: name of the Test, if omitted: all tests are executed */ + string test; /* @brief Test: Test name, if omitted: all tests of category are executed */ + string args; /* @brief Args: The test arguments in JSON format */ + }; + struct TestResult { + string test; /* @brief Test Name of the test executed */ + string status; /* @brief Status after test */ + }; + + using IStringIterator = RPC::IIteratorType; + using ITestResultIterator = RPC::IIteratorType; + + // @property + // @brief Description of the given test + // @param test: Name of the test + // @param description: Description of the test + // @retval ERROR_UNAVAILABLE: Unknown test + // @retval ERROR_BAD_REQUEST: Bad test name + virtual uint32_t Description(const string& test /* @index */, string& description /* @out */) const = 0; + // @property + // @brief Categories of the test + // @param categories - List of test categories + virtual uint32_t Categories(IStringIterator*& categories /* @out */) const = 0; + // @property + // @brief List of test for selected category + // @param category: Name of the Category + // @retval ERROR_UNAVAILABLE: Unknown category + // @retval ERROR_BAD_REQUEST: Bad category name + virtual uint32_t Tests(const string& category /* @index */, IStringIterator*& tests /* @out */) const = 0; + // @brief Run Test based on testInfo given and collect Test results + // @param testInfo: Info about the test to be executed + // @param testResults: Status of the tests executed + // @retval ERROR_UNAVAILABLE: Unknown category/test + // @retval ERROR_BAD_REQUEST: Bad testInfo + virtual uint32_t Run(const TestInfo& testInfo /* @in */, ITestResultIterator*& testResults /* @out */) = 0; + + /* @json:omit */ virtual void Setup() = 0; + /* @json:omit */ virtual void TearDown() = 0; - - virtual ICategory::IIterator* Categories() const = 0; - virtual ICategory* Category(const string& category) const = 0; }; } // namespace QualityAssurance diff --git a/qa_interfaces/ITestUtility.h b/qa_interfaces/ITestUtility.h index c4cafbc9..acf60f8f 100644 --- a/qa_interfaces/ITestUtility.h +++ b/qa_interfaces/ITestUtility.h @@ -21,9 +21,12 @@ #include "Module.h" +// @stubgen:include + namespace Thunder { namespace QualityAssurance { + /* @json 1.0.0 */ struct EXTERNAL ITestUtility : virtual public Core::IUnknown { enum { ID = ID_TESTUTILITY }; @@ -55,9 +58,85 @@ namespace QualityAssurance { virtual string Name() const = 0; }; - virtual ICommand::IIterator* Commands() const = 0; - virtual ICommand* Command(const string& name) const = 0; - virtual uint32_t ShutdownTimeout(const uint32_t timeout) = 0; + struct ParameterInfo { + enum Type : uint8_t { + NUMBER, + STRING, + BOOLEAN, + OBJECT, + SYMBOL + }; + string name; /* @brief Name of command */ + Type type; /* @brief Type of command */ + string comment; /* @brief Comment about command */ + }; + + using IParameterInfoIterator = RPC::IIteratorType; + struct CrashInfo { + string command; /* @brief Command name */ + uint8_t delay; /* @brief Delay (in seconds) before the crash attempt (applicable for *Crash* command) */ + uint8_t count; /* @brief How many times a Crash command will be executed consecutively (applicable for *CrashNTimes* command)*/ + }; + + struct MemoryInfo { + string command; /* @brief Command name */ + uint32_t size; /* @brief Size: The amount of memory in KB for allocation (applicable for *Malloc* commands) */ + }; + + struct MemoryResult { + uint32_t allocated;/* @brief Allocated: already allocated memory in KB */ + uint32_t size; /* @brief Size: Current allocation in KB */ + uint32_t resident; /* @brief Resident: memory in KB */ + }; + + using IStringIterator = RPC::IIteratorType; + + // @property + // @brief Description - Retrieves the description of selected test command + // @param command: Name of the command + // @param description: Description of the command + // @retval ERROR_UNAVAILABLE: Unknown command + // @retval ERROR_BAD_REQUEST: Bad command name + virtual uint32_t Description(const string& command /* @index */, string& description /* @out */) const = 0; + + // @property + // @brief Commands - Retrieves the list of test commands + // @param commands: Names of the commands + virtual uint32_t Commands(IStringIterator*& commands /* @out */) const = 0; + + // @property + // @brief ShutdownTimeout: Timeout to be waited before deactivating the plugin + // @param timeout: Timeout to be waited + virtual uint32_t ShutdownTimeout(const uint32_t timeout /* @in */) = 0; + + // @brief Parameters - Retrieves parameters of the selected test command + // @param command: Name of the command + // @param response: Parameter Data + // @retval ERROR_UNAVAILABLE: Unknown command + // @retval ERROR_BAD_REQUEST: Bad param data format + virtual uint32_t Parameters(const string& command /* @input */, IParameterInfoIterator*& input /* @out */, ParameterInfo& output /* @out */) const = 0; + + // @brief RunCrash - Runs a crash test command + // @param info: Info about crash test to be run + // @retval ERROR_UNAVAILABLE: Unknown command + // @retval ERROR_BAD_REQUEST: Bad param data format + virtual uint32_t RunCrash(const CrashInfo& info /* @in */) = 0; + + // @brief RunMemory - Runs a memory test command + // @param info: Memory info for the test + // @param result: Memory result after test + // @retval ERROR_UNAVAILABLE: Unknown category + // @retval ERROR_BAD_REQUEST: Bad param data format + virtual uint32_t RunMemory(const MemoryInfo& info /* @in */, MemoryResult& result /* @out */) = 0; + + + // @brief Execute - Execute test command + // @param command: Name of the command + // @param params: Parameters details + // @param status: Test status + // @retval ERROR_UNAVAILABLE: Unknown command + // @retval ERROR_BAD_REQUEST: Bad param data format + virtual uint32_t Execute(const string& command /* @in */, const string& params /* @in */, string& status /* @out */) = 0; }; } // namespace QualityAssurance diff --git a/qa_interfaces/QAIds.h b/qa_interfaces/Ids.h similarity index 68% rename from qa_interfaces/QAIds.h rename to qa_interfaces/Ids.h index c5a771d3..1f21fd40 100644 --- a/qa_interfaces/QAIds.h +++ b/qa_interfaces/Ids.h @@ -52,20 +52,21 @@ namespace QualityAssurance { enum IDS : uint32_t { - ID_TESTAUTOMATIONMEMORY = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET, - ID_TESTAUTOMATIONCOMRPC = ID_TESTAUTOMATIONMEMORY + 1, - ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2, + ID_TESTAUTOMATIONMEMORY = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET, + ID_TESTAUTOMATIONCOMRPC = ID_TESTAUTOMATIONMEMORY + 1, + ID_TESTAUTOMATIONCOMRPCINTERNAL = ID_TESTAUTOMATIONMEMORY + 2, - ID_TESTCONTROLLER = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET + 0x010, - ID_TESTCONTROLLER_TEST = ID_TESTCONTROLLER + 1, - ID_TESTCONTROLLER_TEST_ITERATOR = ID_TESTCONTROLLER + 2, - ID_TESTCONTROLLER_CATEGORY = ID_TESTCONTROLLER + 3, - ID_TESTCONTROLLER_CATEGORY_ITERATOR = ID_TESTCONTROLLER + 4, - - ID_TESTUTILITY = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET + 0x020, - ID_TESTUTILITY_COMMAND = ID_TESTUTILITY + 1, - ID_TESTUTILITY_ITERATOR = ID_TESTUTILITY + 2, + ID_TESTCONTROLLER = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET + 0x010, + ID_TESTCONTROLLER_TEST = ID_TESTCONTROLLER + 1, + ID_TESTCONTROLLER_TEST_ITERATOR = ID_TESTCONTROLLER + 2, + ID_TESTCONTROLLER_CATEGORY = ID_TESTCONTROLLER + 3, + ID_TESTCONTROLLER_CATEGORY_ITERATOR = ID_TESTCONTROLLER + 4, + ID_TESTCONTROLLER_TEST_RESULT_ITERATOR = ID_TESTCONTROLLER + 5, + ID_TESTUTILITY = RPC::IDS::ID_EXTERNAL_QA_INTERFACE_OFFSET + 0x020, + ID_TESTUTILITY_COMMAND = ID_TESTUTILITY + 1, + ID_TESTUTILITY_ITERATOR = ID_TESTUTILITY + 2, + ID_TESTUTILITY_COMMAND_PARAMETER_INFO_ITERATOR = ID_TESTUTILITY + 3, }; } } diff --git a/qa_interfaces/Module.h b/qa_interfaces/Module.h index 84bea1eb..db324464 100644 --- a/qa_interfaces/Module.h +++ b/qa_interfaces/Module.h @@ -35,4 +35,4 @@ // All identifiers to identify a QA interface are allocated in this same directory // in the file calls Ids.h, please extend it with your required interface number // if you are creating a new interface. -#include "QAIds.h" +#include "Ids.h" diff --git a/qa_jsonrpc/TestController.json b/qa_jsonrpc/TestController.json deleted file mode 100644 index da9b75b6..00000000 --- a/qa_jsonrpc/TestController.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Test Controller API", - "class": "TestController", - "description": "TestController JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "properties": { - "categories": { - "summary": "List of test categories", - "readonly": true, - "params": { - "type": "array", - "items": { - "type": "string", - "description": "Test category name", - "example": "JSONRPC" - } - } - }, - "tests": { - "summary": "List of tests for a category", - "readonly": true, - "index": { - "name": "Category", - "example": "JSONRPC" - }, - "params": { - "type": "array", - "items": { - "type": "string", - "description": "Test name", - "example": "JSONRPCTest" - } - }, - "errors": [ - { - "description": "Unknown category", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - }, - "description": { - "summary": "Description of a test", - "readonly": true, - "index": { - "name": "Test", - "example": "JSONRPC" - }, - "params": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "Test description", - "example": "Tests JSONRPC functionality" - } - }, - "required": [ - "description" - ] - }, - "errors": [ - { - "description": "Unknown category/test", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - } - }, - "methods": { - "run": { - "summary": "Runs a single test or multiple tests", - "params": { - "type": "object", - "properties": { - "category": { - "description": "Test category name, if omitted: all tests are executed", - "type": "string", - "example": "JSONRPC" - }, - "test": { - "description": "Test name, if omitted: all tests of category are executed", - "type": "string", - "example": "JSONRPCTest" - }, - "args": { - "description": "The test arguments in JSON format", - "type": "string", - "example": "{ }" - } - } - }, - "result": { - "description": "List of test results", - "type": "array", - "items": { - "type": "object", - "properties": { - "test": { - "description": "Test name", - "type": "string", - "example": "JSONRPCTest" - }, - "status": { - "description": "Test status", - "type": "string", - "example": "Success" - } - }, - "required": [ - "test", - "status" - ] - } - }, - "errors": [ - { - "description": "Unknown category/test", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad json param data format", - "$ref": "#/common/errors/badrequest" - } - ] - } - } -} diff --git a/qa_jsonrpc/TestUtility.json b/qa_jsonrpc/TestUtility.json deleted file mode 100644 index e7bea2ed..00000000 --- a/qa_jsonrpc/TestUtility.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Test Utility API", - "class": "TestUtility", - "format": "uncompliant-extended", - "description": "TestUtility JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "definitions": { - "parameter": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Test command parameter", - "example": "memory" - }, - "type": { - "type": "string", - "enum": [ - "Number", - "String", - "Boolean", - "Object", - "Symbol" - ], - "description": "Test command parameter type", - "example": "Number" - }, - "comment": { - "type": "string", - "description": "Test command parameter description", - "example": "Memory statistics in KB" - } - }, - "required": [ - "name", - "type", - "comment" - ] - } - }, - "methods": { - "runmemory": { - "summary": "Runs a memory test command", - "params": { - "type": "object", - "properties": { - "command": { - "description": "Test command name", - "type": "string", - "example": "Malloc" - }, - "size": { - "description": "The amount of memory in KB for allocation (applicable for *Malloc* commands)", - "type": "number", - "example": 0 - } - }, - "required": [ - "command" - ] - }, - "result": { - "type": "object", - "properties": { - "allocated": { - "description": "Already allocated memory in KB", - "type": "number", - "example": 0 - }, - "size": { - "description": "Current allocation in KB", - "type": "number", - "example": 0 - }, - "resident": { - "description": "Resident memory in KB", - "type": "number", - "example": 0 - } - }, - "required": [ - "allocated", - "size", - "resident" - ] - }, - "errors": [ - { - "description": "Unknown category", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - }, - "runcrash": { - "summary": "Runs a crash test command", - "params": { - "type": "object", - "properties": { - "command": { - "description": "Test command name", - "type": "string", - "example": "Crash" - }, - "delay": { - "description": "Delay (in seconds) before the crash attempt (applicable for *Crash* command)", - "type": "number", - "size": 8, - "example": 1 - }, - "count": { - "description": "How many times a Crash command will be executed consecutively (applicable for *CrashNTimes* command)", - "type": "number", - "size": 8, - "example": 1 - } - }, - "required": [ - "command" - ] - }, - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Unknown category", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - } - }, - "properties": { - "commands": { - "summary": "List of test commands", - "readonly": true, - "params": { - "type": "array", - "items": { - "type": "string", - "description": "Available test commands", - "example": "Malloc" - } - } - }, - "description": { - "summary": "Description of a test command", - "readonly": true, - "params": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "Test command description", - "example": "Allocates desired amount of memory (in KB) and holds it" - } - }, - "required": [ - "description" - ] - }, - "index": { - "name": "Command", - "example": "Malloc" - }, - "errors": [ - { - "description": "Unknown category", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - }, - "parameters": { - "summary": "Parameters of a test command", - "readonly": true, - "params": { - "type": "object", - "properties": { - "input": { - "type": "array", - "description": "Input parameter list", - "items": { - "$ref": "#/definitions/parameter" - } - }, - "output": { - "description": "Output parameter list", - "$ref": "#/definitions/parameter" - } - }, - "required": [ - "output" - ] - }, - "index": { - "name": "Command", - "example": "Malloc" - }, - "errors": [ - { - "description": "Unknown category", - "$ref": "#/common/errors/unavailable" - }, - { - "description": "Bad JSON param data format", - "$ref": "#/common/errors/badrequest" - } - ] - }, - "shutdowntimeout": { - "summary": "Timeout to be waited before deactivating the plugin", - "writeonly":true, - "params": { - "description": "Timeout in milli seconds", - "type": "number", - "example": 5000, - "size": 32 - } - } - } -}