Clone of official tools

Revision:
41:2a77626a4c21
Parent:
40:7d3fa6b99b2b
Child:
43:2a7da56ebd24
--- a/test_api.py	Tue Oct 10 16:56:30 2017 -0500
+++ b/test_api.py	Wed Oct 25 14:46:50 2017 -0500
@@ -50,6 +50,7 @@
 from tools.utils import construct_enum
 from tools.memap import MemapParser
 from tools.targets import TARGET_MAP
+import tools.test_configs as TestConfig
 from tools.test_db import BaseDBAccess
 from tools.build_api import build_project, build_mbed_libs, build_lib
 from tools.build_api import get_target_supported_toolchains
@@ -1643,11 +1644,10 @@
 
 
 def get_module_avail(module_name):
-    """ This function returns True if module_name is already impored module
+    """ This function returns True if module_name is already imported module
     """
     return module_name in sys.modules.keys()
 
-
 def get_autodetected_MUTS_list(platform_name_filter=None):
     oldError = None
     if os.name == 'nt':
@@ -1999,6 +1999,19 @@
 
     return "-".join(name_parts).lower()
 
+def 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, boolean of whether it is a module or mbed OS interface
+    """
+    # If they passed in a full path
+    if exists(config_name):
+        # This is a module config
+        return config_name
+    # Otherwise find the path to configuration file based on mbed OS interface
+    return TestConfig.get_config_path(config_name, target_name)
+
 def 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')