Skip to content

Commit

Permalink
bot: add rtt_logger_timeout parameter
Browse files Browse the repository at this point in the history
rtt_logger_timeout can be used as command line argument or as parameter
in config_project.py
  • Loading branch information
piotrnarajowski committed Oct 4, 2024
1 parent 6652482 commit 9b289be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions autopts/bot/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(self, args, **kwargs):
self.pylink_reset = args.get('pylink_reset', False)
self.max_server_restart_time = args.get('max_server_restart_time', MAX_SERVER_RESTART_TIME)
self.use_backup = args.get('use_backup', False)
self.rtt_logger_timeout = args.get('rtt_logger_timeout', 0)

if self.ykush or self.active_hub_server:
self.usb_replug_available = True
Expand Down
4 changes: 4 additions & 0 deletions autopts/ptsprojects/mynewt/iutctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import os
import sys
import serial
import time

from autopts.pybtp import defs, btp
from autopts.ptsprojects.boards import Board, get_debugger_snr, tty_to_com
Expand Down Expand Up @@ -52,6 +53,7 @@ def __init__(self, args):
self.debugger_snr = get_debugger_snr(self.tty_file) \
if args.debugger_snr is None else args.debugger_snr
self.board = Board(args.board_name, self)
self.rtt_logger_timeout = args.rtt_logger_timeout
self.socat_process = None
self.socket_srv = None
self.btp_socket = None
Expand Down Expand Up @@ -140,6 +142,8 @@ def rtt_logger_start(self):

def rtt_logger_stop(self):
if self.rtt_logger:
# Make sure all logs have been collected, in case test failed early.
time.sleep(self.rtt_logger_timeout)
self.rtt_logger.stop()

def reset(self):
Expand Down
4 changes: 3 additions & 1 deletion autopts/ptsprojects/zephyr/iutctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, args):
self.kernel_image = args.kernel_image
self.tty_file = args.tty_file
self.hci = args.hci
self.rtt_logger_timeout = args.rtt_logger_timeout
self.native = None
self.gdb = args.gdb
self.is_running = False
Expand Down Expand Up @@ -205,7 +206,8 @@ def rtt_logger_start(self):

def rtt_logger_stop(self):
if self.rtt_logger:
time.sleep(0.1) # Make sure all logs have been collected, in case test failed early.
# Make sure all logs have been collected, in case test failed early.
time.sleep(self.rtt_logger_timeout)
self.rtt_logger.stop()

def wait_iut_ready_event(self, reset=True):
Expand Down
3 changes: 3 additions & 0 deletions cliparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def __init__(self, cli_support=None, board_names=None, add_help=True):
"Requires rtt support on IUT.",
action='store_true', default=False)

self.add_argument("--rtt_logger_timeout", nargs='?', type=float, default=0,
help="Timeout for rtt logger to make sure all logs have been collected")

self.add_argument("--gdb",
help="Skip board resets to avoid gdb server disconnection.",
action='store_true', default=False)
Expand Down

0 comments on commit 9b289be

Please sign in to comment.