diff mbox series

[v2,3/3] kunit: Introduce get_file_path() helper

Message ID 20201026165927.19020-3-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Delegated to: Shuah Khan
Headers show
Series [v2,1/3] kunit: Do not pollute source directory with generated files (.kunitconfig) | expand

Commit Message

Andy Shevchenko Oct. 26, 2020, 4:59 p.m. UTC
Helper allows to derive file names depending on --build_dir argument.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
---
v2: added tags (Brendan)

 tools/testing/kunit/kunit_kernel.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

Comments

Andy Shevchenko Nov. 3, 2020, 11:25 a.m. UTC | #1
On Wed, Oct 28, 2020 at 10:29:15AM +0100, SeongJae Park wrote:
> On Mon, 26 Oct 2020 18:59:27 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Helper allows to derive file names depending on --build_dir argument.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> > Tested-by: Brendan Higgins <brendanhiggins@google.com>
> 
> Reviewed-by: SeongJae Park <sjpark@amazon.de>

Thanks!

Brendan, Shuah, can we get this series applied, please?
Brendan Higgins Nov. 5, 2020, 4:35 p.m. UTC | #2
On Tue, Nov 3, 2020 at 3:24 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Oct 28, 2020 at 10:29:15AM +0100, SeongJae Park wrote:
> > On Mon, 26 Oct 2020 18:59:27 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Helper allows to derive file names depending on --build_dir argument.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> > > Tested-by: Brendan Higgins <brendanhiggins@google.com>
> >
> > Reviewed-by: SeongJae Park <sjpark@amazon.de>
>
> Thanks!
>
> Brendan, Shuah, can we get this series applied, please?

I'm not actually sure that this qualifies as a fix. I certainly don't
mind if this goes in 5.10, in fact, I would prefer it.

In any case, I added it to Shuah's queue. I will leave it up to Shuah
whether it goes in as a fix in 5.10, or needs to wait for the next
merge window.
Andy Shevchenko Nov. 5, 2020, 5:28 p.m. UTC | #3
On Thu, Nov 05, 2020 at 08:35:16AM -0800, Brendan Higgins wrote:
> On Tue, Nov 3, 2020 at 3:24 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Wed, Oct 28, 2020 at 10:29:15AM +0100, SeongJae Park wrote:
> > > On Mon, 26 Oct 2020 18:59:27 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Helper allows to derive file names depending on --build_dir argument.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> > > > Tested-by: Brendan Higgins <brendanhiggins@google.com>
> > >
> > > Reviewed-by: SeongJae Park <sjpark@amazon.de>
> >
> > Thanks!
> >
> > Brendan, Shuah, can we get this series applied, please?
> 
> I'm not actually sure that this qualifies as a fix. I certainly don't
> mind if this goes in 5.10, in fact, I would prefer it.
> 
> In any case, I added it to Shuah's queue. I will leave it up to Shuah
> whether it goes in as a fix in 5.10, or needs to wait for the next
> merge window.

I'm fine with either. My solely concern is that I would like to get this moved
forward somehow.
Shuah Khan Nov. 5, 2020, 5:56 p.m. UTC | #4
On 11/5/20 10:28 AM, Andy Shevchenko wrote:
> On Thu, Nov 05, 2020 at 08:35:16AM -0800, Brendan Higgins wrote:
>> On Tue, Nov 3, 2020 at 3:24 AM Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com> wrote:
>>> On Wed, Oct 28, 2020 at 10:29:15AM +0100, SeongJae Park wrote:
>>>> On Mon, 26 Oct 2020 18:59:27 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>>>>
>>>>> Helper allows to derive file names depending on --build_dir argument.
>>>>>
>>>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>>>> Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
>>>>> Tested-by: Brendan Higgins <brendanhiggins@google.com>
>>>>
>>>> Reviewed-by: SeongJae Park <sjpark@amazon.de>
>>>
>>> Thanks!
>>>
>>> Brendan, Shuah, can we get this series applied, please?
>>
>> I'm not actually sure that this qualifies as a fix. I certainly don't
>> mind if this goes in 5.10, in fact, I would prefer it.
>>
>> In any case, I added it to Shuah's queue. I will leave it up to Shuah
>> whether it goes in as a fix in 5.10, or needs to wait for the next
>> merge window.
> 
> I'm fine with either. My solely concern is that I would like to get this moved
> forward somehow.
> 

Once the kunit pull request for rc3 clears, I will look at these and
make a call. This patch series finalized during the merge window,
hence you are going to see some delays. If it doesn't make the cut
for fixes, it will go into 5.11

thanks,
-- Shuah
Shuah Khan Nov. 10, 2020, 9:15 p.m. UTC | #5
On 11/5/20 10:56 AM, Shuah Khan wrote:
> On 11/5/20 10:28 AM, Andy Shevchenko wrote:
>> On Thu, Nov 05, 2020 at 08:35:16AM -0800, Brendan Higgins wrote:
>>> On Tue, Nov 3, 2020 at 3:24 AM Andy Shevchenko
>>> <andriy.shevchenko@linux.intel.com> wrote:
>>>> On Wed, Oct 28, 2020 at 10:29:15AM +0100, SeongJae Park wrote:
>>>>> On Mon, 26 Oct 2020 18:59:27 +0200 Andy Shevchenko 
>>>>> <andriy.shevchenko@linux.intel.com> wrote:
>>>>>
>>>>>> Helper allows to derive file names depending on --build_dir argument.
>>>>>>
>>>>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>>>>> Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
>>>>>> Tested-by: Brendan Higgins <brendanhiggins@google.com>
>>>>>
>>>>> Reviewed-by: SeongJae Park <sjpark@amazon.de>
>>>>
>>>> Thanks!
>>>>
>>>> Brendan, Shuah, can we get this series applied, please?
>>>
>>> I'm not actually sure that this qualifies as a fix. I certainly don't
>>> mind if this goes in 5.10, in fact, I would prefer it.
>>>

3/3 will go into 5.11.

>>> In any case, I added it to Shuah's queue. I will leave it up to Shuah
>>> whether it goes in as a fix in 5.10, or needs to wait for the next
>>> merge window.
>>
>> I'm fine with either. My solely concern is that I would like to get 
>> this moved
>> forward somehow.
>>
> 
> Once the kunit pull request for rc3 clears, I will look at these and
> make a call. This patch series finalized during the merge window,
> hence you are going to see some delays. If it doesn't make the cut
> for fixes, it will go into 5.11
> 

Applied 1/3 and 2/3 to

https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/ 
kuni-fixes branch.

I will send them up in my next pull request, probably rc5.

thanks,
-- Shuah
Andy Shevchenko Nov. 11, 2020, 5:19 p.m. UTC | #6
On Tue, Nov 10, 2020 at 02:15:09PM -0700, Shuah Khan wrote:
> On 11/5/20 10:56 AM, Shuah Khan wrote:

...

> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/
> kuni-fixes branch.
> 
> I will send them up in my next pull request, probably rc5.

Thank you!
diff mbox series

Patch

diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index b4768fa03ce0..7e3f7f9aac96 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -23,6 +23,11 @@  DEFAULT_KUNITCONFIG_PATH = 'arch/um/configs/kunit_defconfig'
 BROKEN_ALLCONFIG_PATH = 'tools/testing/kunit/configs/broken_on_uml.config'
 OUTFILE_PATH = 'test.log'
 
+def get_file_path(build_dir, default):
+	if build_dir:
+		default = os.path.join(build_dir, default)
+	return default
+
 class ConfigError(Exception):
 	"""Represents an error trying to configure the Linux kernel."""
 
@@ -92,9 +97,7 @@  class LinuxSourceTreeOperations(object):
 
 	def linux_bin(self, params, timeout, build_dir):
 		"""Runs the Linux UML binary. Must be named 'linux'."""
-		linux_bin = './linux'
-		if build_dir:
-			linux_bin = os.path.join(build_dir, 'linux')
+		linux_bin = get_file_path(build_dir, 'linux')
 		outfile = get_outfile_path(build_dir)
 		with open(outfile, 'w') as output:
 			process = subprocess.Popen([linux_bin] + params,
@@ -103,22 +106,13 @@  class LinuxSourceTreeOperations(object):
 			process.wait(timeout)
 
 def get_kconfig_path(build_dir):
-	kconfig_path = KCONFIG_PATH
-	if build_dir:
-		kconfig_path = os.path.join(build_dir, KCONFIG_PATH)
-	return kconfig_path
+	return get_file_path(build_dir, KCONFIG_PATH)
 
 def get_kunitconfig_path(build_dir):
-	kunitconfig_path = KUNITCONFIG_PATH
-	if build_dir:
-		kunitconfig_path = os.path.join(build_dir, KUNITCONFIG_PATH)
-	return kunitconfig_path
+	return get_file_path(build_dir, KUNITCONFIG_PATH)
 
 def get_outfile_path(build_dir):
-	outfile_path = OUTFILE_PATH
-	if build_dir:
-		outfile_path = os.path.join(build_dir, OUTFILE_PATH)
-	return outfile_path
+	return get_file_path(build_dir, OUTFILE_PATH)
 
 class LinuxSourceTree(object):
 	"""Represents a Linux kernel source tree with KUnit tests."""