diff options
author | Maciej Borzecki <maciej.borzecki@rndity.com> | 2016-12-19 12:20:57 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-22 08:50:16 +0000 |
commit | 5903182484276fec4d9ccbe7ad2c859e9588e5ba (patch) | |
tree | eedefc780ce78ca9c9bb9b50377c93e8c9532103 | |
parent | ba4aeb33a2dfb4ea0a5c06809be2305e0b1521d0 (diff) | |
download | poky-5903182484276fec4d9ccbe7ad2c859e9588e5ba.tar.gz |
oeqa/utils/commands.py: allow use of binaries from native sysroot
Tests may need to run a native tool that is not available on the host
filesystem, but can be built using one of the *-native recipes. In such case,
the tool will be available in native sysroot, and running in from that location
will require adjustments to PATH.
runCmd() can now take a path to native sysroot as one of its arguments and
setup PATH accordingly.
(From OE-Core rev: f2a04631949db72d4261d1c142c5044fad3741f9)
Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/utils/commands.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 3a68b001b7..0425c9fd98 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py | |||
@@ -97,9 +97,16 @@ class Result(object): | |||
97 | pass | 97 | pass |
98 | 98 | ||
99 | 99 | ||
100 | def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options): | 100 | def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options): |
101 | result = Result() | 101 | result = Result() |
102 | 102 | ||
103 | if native_sysroot: | ||
104 | extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ | ||
105 | (native_sysroot, native_sysroot, native_sysroot) | ||
106 | nenv = dict(options.get('env', os.environ)) | ||
107 | nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') | ||
108 | options['env'] = nenv | ||
109 | |||
103 | cmd = Command(command, timeout=timeout, **options) | 110 | cmd = Command(command, timeout=timeout, **options) |
104 | cmd.run() | 111 | cmd.run() |
105 | 112 | ||