From: Vitor Massaru Iha <vitor@massaru.org>
To: kunit-dev@googlegroups.com
Cc: brendanhiggins@google.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees
Date: Mon, 30 Mar 2020 20:02:56 -0300 [thread overview]
Message-ID: <20200330230256.28323-1-vitor@massaru.org> (raw)
Fix this bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219
For some reason, the environment variable ARCH is used instead of ARCH
passed as an argument, this patch uses a copy of the env, but using
ARCH=um and CROSS_COMPILER='' to avoid this problem.
This patch doesn't change the user's environment variables, avoiding
side effects.
Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
---
tools/testing/kunit/kunit_kernel.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index d99ae75ef72f..0cb1f81ac8f2 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -15,6 +15,7 @@ import kunit_config
KCONFIG_PATH = '.config'
kunitconfig_path = '.kunitconfig'
+env = dict(os.environ.copy(), ARCH='um', CROSS_COMPILE='')
class ConfigError(Exception):
"""Represents an error trying to configure the Linux kernel."""
@@ -36,22 +37,22 @@ class LinuxSourceTreeOperations(object):
raise ConfigError(e.output)
def make_olddefconfig(self, build_dir):
- command = ['make', 'ARCH=um', 'olddefconfig']
+ command = ['make', 'olddefconfig']
if build_dir:
command += ['O=' + build_dir]
try:
- subprocess.check_output(command)
+ subprocess.check_output(command, env=env)
except OSError as e:
raise ConfigError('Could not call make command: ' + e)
except subprocess.CalledProcessError as e:
raise ConfigError(e.output)
def make(self, jobs, build_dir):
- command = ['make', 'ARCH=um', '--jobs=' + str(jobs)]
+ command = ['make', '--jobs=' + str(jobs)]
if build_dir:
command += ['O=' + build_dir]
try:
- subprocess.check_output(command)
+ subprocess.check_output(command, env=env)
except OSError as e:
raise BuildError('Could not call execute make: ' + e)
except subprocess.CalledProcessError as e:
@@ -66,7 +67,8 @@ class LinuxSourceTreeOperations(object):
[linux_bin] + params,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ env=env)
process.wait(timeout=timeout)
return process
--
2.21.1
next reply other threads:[~2020-03-30 23:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 23:02 Vitor Massaru Iha [this message]
2020-03-31 18:27 ` Brendan Higgins
2020-03-31 19:38 ` Vitor Massaru Iha
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=20200330230256.28323-1-vitor@massaru.org \
--to=vitor@massaru.org \
--cc=brendanhiggins@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®