Skip to content

Commit

Permalink
Remove the Mbed reference from standalone htrun
Browse files Browse the repository at this point in the history
Note:
Unfortunately found that some of the unused code and needs a further cleanup
  • Loading branch information
rajkan01 committed Jun 2, 2021
1 parent 5af074e commit b43533c
Show file tree
Hide file tree
Showing 29 changed files with 234 additions and 259 deletions.
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from distutils.core import setup
from setuptools import find_packages


DESCRIPTION = "The Greentea CLI and host-tests runner (htrun) is a collection of tools that enable automated testing on mbed-enabled platforms"
DESCRIPTION = "The Greentea CLI and host-tests runner (htrun) is a collection of tools that enable automated testing on greentea supported hardware platforms"
OWNER_NAMES = 'Mbed team'
OWNER_EMAILS = '[email protected]'

Expand All @@ -49,7 +48,7 @@ def read(fname):
test_requirements = fh.readlines()

python_requires = '>=3.5.*,<4'
setup(name='mbed-greentea',
setup(name='greentea',
description=DESCRIPTION,
long_description=read('README.md'),
long_description_content_type='text/markdown',
Expand All @@ -64,7 +63,7 @@ def read(fname):
test_suite='test',
entry_points={
"console_scripts":
["mbedgt=mbed_greentea.mbed_greentea_cli:main",
["gt=greentea.greentea_cli:main",
"htrun=htrun.htrun:main"],
},
classifiers=(
Expand Down
6 changes: 3 additions & 3 deletions src/htrun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"""! @package htrun
Flash, reset and perform host supervised tests on mbed platforms.
Flash, reset and perform host supervised tests on Greentea supported hardware platforms.
Write your own programs (import this package) or use 'htrun'
command line tool instead.
Expand Down Expand Up @@ -78,7 +78,7 @@ def init_host_test_cli_params():
"-t",
"--target-id",
dest="target_id",
help="Unique Target Id or mbed platform",
help="Unique Target Id",
metavar="TARGET_ID",
)

Expand Down Expand Up @@ -360,7 +360,7 @@ def init_host_test_cli_params():
)

parser.description = (
"""Flash, reset and perform host supervised tests on mbed platforms"""
"""Flash, reset and perform host supervised tests on Greentea supported hardware platforms"""
)
parser.epilog = (
"""Example: htrun -d E: -p COM5 -f "test.bin" -C 4 -c shell -m K64F"""
Expand Down
16 changes: 8 additions & 8 deletions src/htrun/host_tests_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""! @package mbed-host-test-plugins
"""! @package greentea-host-test-plugins
This package contains plugins used by host test to reset, flash devices etc.
This package can be extended with new packages to add more generic functionality
Expand All @@ -24,9 +24,9 @@

# This plugins provide 'flashing' and 'reset' methods to host test scripts
from . import module_copy_shell
from . import module_copy_mbed
from . import module_reset_mbed
from . import module_power_cycle_mbed
from . import module_copy_to_target
from . import module_reset_target
from . import module_power_cycle_target
from . import module_copy_pyocd
from . import module_reset_pyocd

Expand All @@ -48,9 +48,9 @@

# Static plugin registration
# Some plugins are commented out if they are not stable or not commonly used
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_to_target.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_target.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_pyocd.load_plugin())

# Extra platforms support
Expand All @@ -60,7 +60,7 @@
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_stlink.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_stlink.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_power_cycle_mbed.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_power_cycle_target.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_pyocd.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_ublox.load_plugin())
HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_ublox.load_plugin())
Expand Down
8 changes: 4 additions & 4 deletions src/htrun/host_tests_plugins/host_test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def is_os_supported(self, os_name=None):
"""!
@return Returns true if plugin works (supportes) under certain OS
@os_name String describing OS.
See self.mbed_os_support() and self.mbed_os_info()
See self.host_os_support() and self.host_os_info()
@details In some cases a plugin will not work under particular OS
mainly because command / software used to implement plugin
functionality is not available e.g. on MacOS or Linux.
Expand Down Expand Up @@ -241,7 +241,7 @@ def run_command(self, cmd, shell=True, stdin = None):
self.print_plugin_error(str(e))
return result

def mbed_os_info(self):
def host_os_info(self):
"""! Returns information about host OS
@return Returns tuple with information about OS and host platform
"""
Expand All @@ -252,13 +252,13 @@ def mbed_os_info(self):
sys.platform)
return result

def mbed_os_support(self):
def host_os_support(self):
"""! Function used to determine host OS
@return Returns None if host OS is unknown, else string with name
@details This function should be ported for new OS support
"""
result = None
os_info = self.mbed_os_info()
os_info = self.host_os_info()
if (os_info[0] == 'nt' and os_info[1] == 'Windows'):
result = 'Windows7'
elif (os_info[0] == 'posix' and os_info[1] == 'Linux' and ('Ubuntu' in os_info[3])):
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_copy_jn51xx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -35,7 +35,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_copy_stlink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -35,7 +35,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,20 +18,20 @@
from .host_test_plugins import HostTestPluginBase


class HostTestPluginCopyMethod_Mbed(HostTestPluginBase):
""" Generic flashing method for mbed-enabled devices (by copy)
class HostTestPluginCopyMethod_Target(HostTestPluginBase):
""" Generic flashing method for Greentea supported devices (by copy)
"""

def __init__(self):
""" ctor
"""
HostTestPluginBase.__init__(self)

def generic_mbed_copy(self, image_path, destination_disk):
"""! Generic mbed copy method for "mbed enabled" devices.
def generic_target_copy(self, image_path, destination_disk):
"""! Generic target copy method for "Greentea supported" devices.
@param image_path Path to binary file to be flashed
@param destination_disk Path to destination (mbed mount point)
@param destination_disk Path to destination (target mount point)
@details It uses standard python shutil function to copy image_file (target specific binary) to device's disk.
Expand All @@ -49,7 +49,7 @@ def generic_mbed_copy(self, image_path, destination_disk):
return result

# Plugin interface
name = 'HostTestPluginCopyMethod_Mbed'
name = 'HostTestPluginCopyMethod_Target'
type = 'CopyMethod'
stable = True
capabilities = ['shutil', 'default']
Expand Down Expand Up @@ -89,11 +89,11 @@ def execute(self, capability, *args, **kwargs):
# available in result (_, destination_disk) of check_mount_point_ready
mount_res, destination_disk = self.check_mount_point_ready(destination_disk, target_id=self.target_id, timeout=pooling_timeout) # Blocking
if mount_res:
result = self.generic_mbed_copy(image_path, destination_disk)
result = self.generic_target_copy(image_path, destination_disk)
return result


def load_plugin():
""" Returns plugin available in this module
"""
return HostTestPluginCopyMethod_Mbed()
return HostTestPluginCopyMethod_Target()
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_copy_ublox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -30,7 +30,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -49,7 +49,7 @@ def execute(self, capability, *args, **kwargs):
@return Capability call return value
"""
if 'target_id' not in kwargs or not kwargs['target_id']:
self.print_plugin_error("Error: This plugin requires mbed target_id")
self.print_plugin_error("Error: This plugin requires unique target_id")
return False

if 'device_info' not in kwargs or type(kwargs['device_info']) is not dict:
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_reset_jn51xx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -35,7 +35,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_reset_stlink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -40,7 +40,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from .host_test_plugins import HostTestPluginBase


class HostTestPluginResetMethod_Mbed(HostTestPluginBase):
class HostTestPluginResetMethod_Target(HostTestPluginBase):

# Plugin interface
name = 'HostTestPluginResetMethod_Mbed'
name = 'HostTestPluginResetMethod_Target'
type = 'ResetMethod'
stable = True
capabilities = ['default']
Expand Down Expand Up @@ -128,4 +128,4 @@ def execute(self, capability, *args, **kwargs):
def load_plugin():
"""! Returns plugin available in this module
"""
return HostTestPluginResetMethod_Mbed()
return HostTestPluginResetMethod_Target()
4 changes: 2 additions & 2 deletions src/htrun/host_tests_plugins/module_reset_ublox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -30,7 +30,7 @@ def is_os_supported(self, os_name=None):
"""
# If no OS name provided use host OS name
if not os_name:
os_name = self.mbed_os_support()
os_name = self.host_os_support()

# This plugin only works on Windows
if os_name and os_name.startswith('Windows'):
Expand Down
2 changes: 1 addition & 1 deletion src/htrun/host_tests_registry/host_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def table(self, verbose=False):

def register_from_path(self, path, verbose=False):
""" Enumerates and registers locally stored host tests
Host test are derived from mbed_os_tools.test.BaseHostTest classes
Host test are derived from htrun.BaseHostTest classes
"""
if path:
path = path.strip('"')
Expand Down
6 changes: 3 additions & 3 deletions src/htrun/host_tests_runner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""! @package mbed-host-test-runner
"""! @package greentea-host-test-runner
This package contains basic host test implementation with algorithms to flash and reset device.
Functionality can be overridden by set of plugins which can provide specialised flashing and reset implementations.
Expand All @@ -22,4 +22,4 @@

from pkg_resources import get_distribution

__version__ = get_distribution("mbed-os-tools").version
__version__ = get_distribution("greentea").version
6 changes: 3 additions & 3 deletions src/htrun/host_tests_runner/host_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, Arm Limited and affiliates.
# Copyright (c) 2021, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,7 +14,7 @@
# limitations under the License.

from sys import stdout
from .mbed_base import Mbed
from .target_base import Base
from . import __version__


Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(self, options):
""" ctor
"""
HostTestResults.__init__(self)
self.mbed = Mbed(options)
self.target = Base(options)

def run(self):
""" Test runner for host test. This function will start executing
Expand Down
Loading

0 comments on commit b43533c

Please sign in to comment.