mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

tools::test_api Namespace Reference

tools::test_api Namespace Reference

Data Structures

class  SingleTestExecutor
class  SingleTestRunner
class  TestLogger
class  CLITestLogger

Functions

def get_unique_value_from_summary
def get_unique_value_from_summary_ext
def show_json_file_format_error
def json_format_error_defect_pos
def get_json_data_from_file
def print_muts_configuration_from_json
def print_test_configuration_from_json
def get_avail_tests_summary_table
def progress_bar
def singletest_in_cli_mode
def factory_db_logger
def detect_database_verbose
def get_module_avail
def get_autodetected_MUTS
def get_autodetected_TEST_SPEC
def get_default_test_options_parser
def test_path_to_name
def find_tests
def print_tests
def norm_relative_path
def build_test_worker
def build_tests

Detailed Description

mbed SDK
Copyright (c) 2011-2014 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: Przemyslaw Wirkus <Przemyslaw.wirkus@arm.com>

Function Documentation

def tools::test_api::build_test_worker (   args,
  kwargs 
)
This is a worker function for the parallel building of tests. The `args`
and `kwargs` are passed directly to `build_project`. It returns a dictionary
with the following structure:

{
    'result': `True` if no exceptions were thrown, `False` otherwise
    'reason': Instance of exception that was thrown on failure
    'bin_file': Path to the created binary if `build_project` was
                successful. Not present otherwise
    'kwargs': The keyword arguments that were passed to `build_project`.
              This includes arguments that were modified (ex. report)
}

Definition at line 2074 of file test_api.py.

def tools::test_api::build_tests (   tests,
  base_source_paths,
  build_path,
  target,
  toolchain_name,
  clean = False,
  notify = None,
  verbose = False,
  jobs = 1,
  macros = None,
  silent = False,
  report = None,
  properties = None,
  continue_on_build_fail = False,
  app_config = None,
  build_profile = None 
)
Given the data structure from 'find_tests' and the typical build parameters,
build all the tests

Returns a tuple of the build result (True or False) followed by the test
build data structure

Definition at line 2121 of file test_api.py.

def tools::test_api::detect_database_verbose (   db_url )
uses verbose mode (prints) database detection sequence to check it database connection string is valid

Definition at line 1627 of file test_api.py.

def tools::test_api::factory_db_logger (   db_url )
Factory database driver depending on database type supplied in database connection string db_url

Definition at line 1614 of file test_api.py.

def tools::test_api::find_tests (   base_dir,
  target_name,
  toolchain_name,
  app_config = None 
)
Finds all tests in a directory recursively
base_dir: path to the directory to scan for tests (ex. 'path/to/project')
target_name: name of the target to use for scanning (ex. 'K64F')
toolchain_name: name of the toolchain to use for scanning (ex. 'GCC_ARM')
options: Compile options to pass to the toolchain (ex. ['debug-info'])
app_config - location of a chosen mbed_app.json file

Definition at line 2004 of file test_api.py.

def tools::test_api::get_autodetected_MUTS (   mbeds_list,
  platform_name_filter = None 
)
Function detects all connected to host mbed-enabled devices and generates artificial MUTS file.
    If function fails to auto-detect devices it will return empty dictionary.

    if get_module_avail('mbed_lstools'):
        mbeds = mbed_lstools.create()
        mbeds_list = mbeds.list_mbeds()

    @param mbeds_list list of mbeds captured from mbed_lstools
    @param platform_name You can filter 'platform_name' with list of filtered targets from 'platform_name_filter'

Definition at line 1673 of file test_api.py.

def tools::test_api::get_autodetected_TEST_SPEC (   mbeds_list,
  use_default_toolchain = True,
  use_supported_toolchains = False,
  toolchain_filter = None,
  platform_name_filter = None 
)
Function detects all connected to host mbed-enabled devices and generates artificial test_spec file.
    If function fails to auto-detect devices it will return empty 'targets' test_spec description.

    use_default_toolchain - if True add default toolchain to test_spec
    use_supported_toolchains - if True add all supported toolchains to test_spec
    toolchain_filter - if [...list of toolchains...] add from all toolchains only those in filter to test_spec

Definition at line 1709 of file test_api.py.

def tools::test_api::get_avail_tests_summary_table (   cols = None,
  result_summary = True,
  join_delim = ',
  platform_filter = None 
)
Generates table summary with all test cases and additional test cases
    information using pretty print functionality. Allows test suite user to
    see test cases

Definition at line 1388 of file test_api.py.

def tools::test_api::get_default_test_options_parser (  )
Get common test script options used by CLI, web services etc.

Definition at line 1746 of file test_api.py.

def tools::test_api::get_json_data_from_file (   json_spec_filename,
  verbose = False 
)
Loads from file JSON formatted string to data structure

Definition at line 1244 of file test_api.py.

def tools::test_api::get_module_avail (   module_name )
This function returns True if module_name is already impored module

Definition at line 1653 of file test_api.py.

def tools::test_api::get_unique_value_from_summary (   test_summary,
  index 
)
Gets list of unique target names

Definition at line 1185 of file test_api.py.

def tools::test_api::get_unique_value_from_summary_ext (   test_summary,
  index_key,
  index_val 
)
Gets list of unique target names and return dictionary

Definition at line 1196 of file test_api.py.

def tools::test_api::json_format_error_defect_pos (   json_error_msg )
Gets first error line and column in JSON file format.
    Parsed from exception thrown by json.loads() string

Definition at line 1222 of file test_api.py.

def tools::test_api::norm_relative_path (   path,
  start 
)
This function will create a normalized, relative path. It mimics the
python os.path.relpath function, but also normalizes a Windows-syle path
that use backslashes to a Unix style path that uses forward slashes.

Definition at line 2064 of file test_api.py.

def tools::test_api::print_muts_configuration_from_json (   json_data,
  join_delim = ",
  platform_filter = None 
)
Prints MUTs configuration passed to test script for verboseness

Definition at line 1272 of file test_api.py.

def tools::test_api::print_test_configuration_from_json (   json_data,
  join_delim = " 
)
Prints test specification configuration passed to test script for verboseness

Definition at line 1307 of file test_api.py.

def tools::test_api::print_tests (   tests,
  format = "list",
  sort = True 
)
Given a dictionary of tests (as returned from "find_tests"), print them
in the specified format

Definition at line 2049 of file test_api.py.

def tools::test_api::progress_bar (   percent_progress,
  saturation = 0 
)
This function creates progress bar with optional simple saturation mark

Definition at line 1487 of file test_api.py.

def tools::test_api::show_json_file_format_error (   json_spec_filename,
  line,
  column 
)
Prints JSON broken content

Definition at line 1208 of file test_api.py.

def tools::test_api::singletest_in_cli_mode (   single_test )
Runs SingleTestRunner object in CLI (Command line interface) mode

    @return returns success code (0 == success) for building and running tests

Definition at line 1499 of file test_api.py.

def tools::test_api::test_path_to_name (   path,
  base 
)
Change all slashes in a path into hyphens
This creates a unique cross-platform test name based on the path
This can eventually be overriden by a to-be-determined meta-data mechanism

Definition at line 1992 of file test_api.py.