All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Borzecki <maciej.borzecki@rndity.com>
To: openembedded-core@lists.openembedded.org
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>,
	Maciej Borzecki <maciek.borzecki@gmail.com>
Subject: [PATCH v4 2/7] oeqa/utils/commands.py: allow use of binaries from native sysroot
Date: Wed, 23 Nov 2016 08:46:28 +0100	[thread overview]
Message-ID: <b2eab9f7415c66ae0e2b297a3875cdf75f281d43.1479887010.git.maciej.borzecki@rndity.com> (raw)
In-Reply-To: <cover.1479887010.git.maciej.borzecki@rndity.com>
In-Reply-To: <cover.1479887010.git.maciej.borzecki@rndity.com>

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>
---
 meta/lib/oeqa/utils/commands.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 5cd0f7477baa5bb45f2b2b5b93fb1ff0efd02923..657c9dba34ea9d42aa416f3b889f4b04129e8da9 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -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()
 
-- 
2.5.0



  parent reply	other threads:[~2016-11-23  7:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23  7:46 [PATCH v4 0/7] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzecki
2016-11-23  7:46 ` [PATCH v4 1/7] oe-selftest: enforce en_US.UTF-8 locale Maciej Borzecki
2016-11-23  7:46 ` Maciej Borzecki [this message]
2016-11-23  7:46 ` [PATCH v4 3/7] wic: add --fixed-size wks option Maciej Borzecki
2016-11-23  7:46 ` [PATCH v4 4/7] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
2016-11-23  7:46 ` [PATCH v4 5/7] wic: selftest: do not repeat core-image-minimal Maciej Borzecki
2016-11-23 11:23   ` Ed Bartosh
2016-11-23 11:39     ` Maciej Borzęcki
2016-11-23 13:26       ` Ed Bartosh
2016-11-23  7:46 ` [PATCH v4 6/7] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
2016-11-23  7:46 ` [PATCH v4 7/7] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
2016-11-23 11:36   ` Ed Bartosh
2016-11-23 11:47     ` Maciej Borzęcki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2eab9f7415c66ae0e2b297a3875cdf75f281d43.1479887010.git.maciej.borzecki@rndity.com \
    --to=maciej.borzecki@rndity.com \
    --cc=maciek.borzecki@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.