]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils/commands.py: allow use of binaries from native sysroot
authorMaciej Borzecki <maciej.borzecki@rndity.com>
Mon, 19 Dec 2016 11:20:57 +0000 (12:20 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 22 Dec 2016 08:46:35 +0000 (08:46 +0000)
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.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/commands.py

index 3a68b001b76ca89df17545912e2f75ca2cca6a38..0425c9fd98c7e8074ced6222156f5a1c2a393f50 100644 (file)
@@ -97,9 +97,16 @@ class Result(object):
     pass
 
 
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options):
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options):
     result = Result()
 
+    if native_sysroot:
+        extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
+                      (native_sysroot, native_sysroot, native_sysroot)
+        nenv = dict(options.get('env', os.environ))
+        nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '')
+        options['env'] = nenv
+
     cmd = Command(command, timeout=timeout, **options)
     cmd.run()