mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
test/py: run sandbox in source directory
Some unit tests expect the cwd of the sandbox process to be the root of the source tree. Ensure that requirement is met. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
77bcb22d77
commit
d27f2fc1e1
2 changed files with 7 additions and 3 deletions
|
@ -20,11 +20,13 @@ class Spawn(object):
|
|||
sent to the process, and responses waited for.
|
||||
"""
|
||||
|
||||
def __init__(self, args):
|
||||
def __init__(self, args, cwd=None):
|
||||
"""Spawn (fork/exec) the sub-process.
|
||||
|
||||
Args:
|
||||
args: array of processs arguments. argv[0] is the command to execute.
|
||||
args: array of processs arguments. argv[0] is the command to
|
||||
execute.
|
||||
cwd: the directory to run the process in, or None for no change.
|
||||
|
||||
Returns:
|
||||
Nothing.
|
||||
|
@ -44,6 +46,8 @@ class Spawn(object):
|
|||
# run under "go" (www.go.cd). Perhaps this happens under any
|
||||
# background (non-interactive) system?
|
||||
signal.signal(signal.SIGHUP, signal.SIG_DFL)
|
||||
if cwd:
|
||||
os.chdir(cwd)
|
||||
os.execvp(args[0], args)
|
||||
except:
|
||||
print 'CHILD EXECEPTION:'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue