1 # Copyright (c) 2015 Stephen Warren
2 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
4 # SPDX-License-Identifier: GPL-2.0
6 # Logic to interact with the sandbox port of U-Boot, running as a sub-process.
9 from u_boot_spawn import Spawn
10 from u_boot_console_base import ConsoleBase
12 class ConsoleSandbox(ConsoleBase):
13 '''Represents a connection to a sandbox U-Boot console, executed as a sub-
16 def __init__(self, log, config):
17 '''Initialize a U-Boot console connection.
20 log: A multiplexed_log.Logfile instance.
21 config: A "configuration" object as defined in conftest.py.
27 super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
30 '''Connect to a fresh U-Boot instance.
32 A new sandbox process is created, so that U-Boot begins running from
39 A u_boot_spawn.Spawn object that is attached to U-Boot.
42 return Spawn([self.config.build_dir + '/u-boot'])
45 '''Send a specific Unix signal to the sandbox process.
48 sig: The Unix signal to send to the process.
55 self.log.action('kill %d' % sig)
58 def validate_exited(self):
59 '''Determine whether the sandbox process has exited.
61 If required, this function waits a reasonable time for the process to
68 Boolean indicating whether the process has exited.