From c4397b75b700f50aa9573f300672040592eb7b9d Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Wed, 29 Oct 2014 14:28:02 +0000 Subject: [PATCH] Host test plugins: moved program cycle sleep time to host_test - this delay is used to give time device to flash copied file --- workspace_tools/host_tests/host_test.py | 11 ++++++++++- workspace_tools/test_api.py | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/workspace_tools/host_tests/host_test.py b/workspace_tools/host_tests/host_test.py index 9b70082d00..19bb02c7e4 100644 --- a/workspace_tools/host_tests/host_test.py +++ b/workspace_tools/host_tests/host_test.py @@ -67,6 +67,12 @@ class Mbed: help="Copy method selector", metavar="COPY_METHOD") + parser.add_option("-C", "--program_cycle_s", + dest="program_cycle_s", + help="Program cycle sleep. Define how many seconds you want wait after copying bianry onto target", + type="float", + metavar="COPY_METHOD") + parser.add_option("-t", "--timeout", dest="timeout", help="Timeout", @@ -95,6 +101,7 @@ class Mbed: self.disk = self.options.disk self.image_path = self.options.image_path.strip('"') self.copy_method = self.options.copy_method + self.program_cycle_s = float(self.options.program_cycle_s) self.serial = None self.timeout = self.DEFAULT_TOUT if self.options.timeout is None else self.options.timeout @@ -192,7 +199,9 @@ class Mbed: disk = disk if disk is not None else self.disk copy_method = copy_method if copy_method is not None else self.copy_method # Call proper copy method - return self.copy_image_raw(image_path, disk, copy_method) + result = self.copy_image_raw(image_path, disk, copy_method) + sleep(self.program_cycle_s) + return result def copy_image_raw(self, image_path=None, disk=None, copy_method=None): """ Copy file depending on method you want to use. Handles exception diff --git a/workspace_tools/test_api.py b/workspace_tools/test_api.py index 2b5ca115c3..8fda5330ae 100644 --- a/workspace_tools/test_api.py +++ b/workspace_tools/test_api.py @@ -669,7 +669,6 @@ class SingleTestRunner(object): single_test_output = self.logger.log_line(self.logger.LogType.ERROR, 'Image file does not exist: %s'% image_path) print single_test_output else: - sleep(target_by_mcu.program_cycle_s()) # Host test execution start_host_exec_time = time() @@ -681,7 +680,8 @@ class SingleTestRunner(object): verbose=host_test_verbose, reset=host_test_reset, reset_tout=reset_tout, - copy_method=selected_copy_method) + copy_method=selected_copy_method, + program_cycle_s=target_by_mcu.program_cycle_s()) # Store test result test_all_result.append(single_test_result) @@ -759,7 +759,7 @@ class SingleTestRunner(object): def run_host_test(self, name, image_path, disk, port, duration, micro=None, reset=None, reset_tout=None, - verbose=False, copy_method=None): + verbose=False, copy_method=None, program_cycle_s=None): """ Function creates new process with host test configured with particular test case. Function also is pooling for serial port activity from process to catch all data printed by test runner and host test during test execution @@ -798,7 +798,8 @@ class SingleTestRunner(object): '-d', disk, '-f', '"%s"'% image_path, '-p', port, - '-t', str(duration)] + '-t', str(duration), + '-C', str(program_cycle_s)] # Add extra parameters to host_test if copy_method is not None: