linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH v2] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees
@ 2020-04-01  1:36 Vitor Massaru Iha
  2020-04-06 18:12 ` Brendan Higgins via Linux-kernel-mentees
  0 siblings, 1 reply; 3+ messages in thread
From: Vitor Massaru Iha @ 2020-04-01  1:36 UTC (permalink / raw)
  To: kunit-dev
  Cc: linux-kernel-mentees, brendanhiggins, linux-kernel, linux-kselftest

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>
---
v2:
 - Use the correct next branch
---
 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 cc5d844ecca1..5c30751387c7 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

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees
  2020-04-01  1:36 [Linux-kernel-mentees] [PATCH v2] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees Vitor Massaru Iha
@ 2020-04-06 18:12 ` Brendan Higgins via Linux-kernel-mentees
  2020-04-06 22:09   ` Vitor Massaru Iha
  0 siblings, 1 reply; 3+ messages in thread
From: Brendan Higgins via Linux-kernel-mentees @ 2020-04-06 18:12 UTC (permalink / raw)
  To: Vitor Massaru Iha
  Cc: linux-kernel-mentees, Linux Kernel Mailing List,
	open list:KERNEL SELFTEST FRAMEWORK, KUnit Development

On Tue, Mar 31, 2020 at 6:36 PM Vitor Massaru Iha <vitor@massaru.org> wrote:
>
> 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>

Sorry for the delayed reply. I had two people finish up on my team
last week and I needed to do some things for that. You now have my
undivided attention.

So, I tried to apply this patch and it still doesn't apply on
kselftest/kunit. At this point, basing your changes on torvalds/master
would be fine since kselftest/kunit just got merged for 5.7.

Can you use the --base branch option when you send your next revision
so I know what branch you are working against (just to be sure)?
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees
  2020-04-06 18:12 ` Brendan Higgins via Linux-kernel-mentees
@ 2020-04-06 22:09   ` Vitor Massaru Iha
  0 siblings, 0 replies; 3+ messages in thread
From: Vitor Massaru Iha @ 2020-04-06 22:09 UTC (permalink / raw)
  To: Brendan Higgins
  Cc: linux-kernel-mentees, Linux Kernel Mailing List,
	open list:KERNEL SELFTEST FRAMEWORK, KUnit Development

On Mon, 2020-04-06 at 11:12 -0700, Brendan Higgins wrote:
> On Tue, Mar 31, 2020 at 6:36 PM Vitor Massaru Iha <vitor@massaru.org>
> wrote:
> > 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>
> 
> Sorry for the delayed reply. I had two people finish up on my team
> last week and I needed to do some things for that. You now have my
> undivided attention.

np

> So, I tried to apply this patch and it still doesn't apply on
> kselftest/kunit. At this point, basing your changes on
> torvalds/master
> would be fine since kselftest/kunit just got merged for 5.7.
> 
> Can you use the --base branch option when you send your next revision
> so I know what branch you are working against (just to be sure)?

Sure, I'll do that.

Thanks!
Vitor


_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-06 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01  1:36 [Linux-kernel-mentees] [PATCH v2] kunit: Fix kunit.py run --build_dir='<foo>' fails on "unclean" trees Vitor Massaru Iha
2020-04-06 18:12 ` Brendan Higgins via Linux-kernel-mentees
2020-04-06 22:09   ` Vitor Massaru Iha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).