Message ID | 1453964274-9129-8-git-send-email-swarren@wwwdotorg.org |
---|---|
State | Accepted |
Commit | d27f2fc1e19c70d529932cf5725259dded19d5fd |
Delegated to: | Simon Glass |
Headers | show |
On 27 January 2016 at 23:57, Stephen Warren <swarren@wwwdotorg.org> wrote: > From: Stephen Warren <swarren@nvidia.com> > > 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> > --- > test/py/u_boot_console_sandbox.py | 2 +- > test/py/u_boot_spawn.py | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) Acked-by: Simon Glass <sjg@chromium.org>
On 28 January 2016 at 20:47, Simon Glass <sjg@chromium.org> wrote: > On 27 January 2016 at 23:57, Stephen Warren <swarren@wwwdotorg.org> wrote: >> From: Stephen Warren <swarren@nvidia.com> >> >> 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> >> --- >> test/py/u_boot_console_sandbox.py | 2 +- >> test/py/u_boot_spawn.py | 8 ++++++-- >> 2 files changed, 7 insertions(+), 3 deletions(-) > > Acked-by: Simon Glass <sjg@chromium.org> Applied to u-boot-dm, thanks!
diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py index bbf41e788ba3..a7263f30b8ca 100644 --- a/test/py/u_boot_console_sandbox.py +++ b/test/py/u_boot_console_sandbox.py @@ -44,7 +44,7 @@ class ConsoleSandbox(ConsoleBase): '-d', self.config.build_dir + '/arch/sandbox/dts/test.dtb' ] - return Spawn(cmd) + return Spawn(cmd, cwd=self.config.source_dir) def kill(self, sig): """Send a specific Unix signal to the sandbox process. diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 7451455671b9..0f52d3e945c7 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -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:'