Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 | get_test_config |
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 2162 of file test_api.py.
def tools::test_api::build_tests | ( | tests, | |
base_source_paths, | |||
build_path, | |||
target, | |||
toolchain_name, | |||
clean = False , |
|||
notify = None , |
|||
jobs = 1 , |
|||
macros = None , |
|||
silent = False , |
|||
report = None , |
|||
properties = None , |
|||
continue_on_build_fail = False , |
|||
app_config = None , |
|||
build_profile = None , |
|||
stats_depth = 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 2209 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 1668 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 1655 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 returns a dictionary where keys are the test name, and the values are lists of paths needed to biuld the test.
Definition at line 2063 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 1713 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 1749 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 1428 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 1786 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 1283 of file test_api.py.
def tools::test_api::get_module_avail | ( | module_name ) |
This function returns True if module_name is already imported module
Definition at line 1694 of file test_api.py.
def tools::test_api::get_test_config | ( | config_name, | |
target_name | |||
) |
Finds the path to a test configuration file config_name: path to a custom configuration file OR mbed OS interface "ethernet, wifi_odin, etc" target_name: name of target to determing if mbed OS interface given is valid returns path to config, will return None if no valid config is found
Definition at line 2050 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 1223 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 1234 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 1261 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 2152 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 1312 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 1347 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 2136 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 1527 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 1246 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 1539 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 2038 of file test_api.py.
Generated on Tue Jul 12 2022 18:19:10 by
