linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sjpark@amazon.com>
To: <brendanhiggins@google.com>
Cc: SeongJae Park <sjpark@amazon.de>, <skhan@linuxfoundation.org>,
	<linux-kselftest@vger.kernel.org>, <kunit-dev@googlegroups.com>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 2/2] kunit: tool: Mark 'kunittest_config' as constant again
Date: Thu, 22 Oct 2020 09:40:11 +0200	[thread overview]
Message-ID: <20201022074011.1990-3-sjpark@amazon.com> (raw)
In-Reply-To: <20201022074011.1990-1-sjpark@amazon.com>

From: SeongJae Park <sjpark@amazon.de>

'kunit_kernel.kunittest_config' was constant at first, and therefore it
used UPPER_SNAKE_CASE naming convention that usually means it is
constant in Python world.  But, commit e3212513a8f0 ("kunit: Create
default config in '--build_dir'") made it modifiable to fix a use case
of the tool and thus the naming also changed to lower_snake_case.
However, this resulted in a confusion.  As a result, some successing
changes made the tool unittest fail, and a fix[1] of it again incurred
the '--build_dir' use case failure.

As the previous commit fixed the '--build_dir' use case without
modifying the variable again, this commit marks the variable as constant
again with UPPER_SNAKE_CASE, to reduce future confusions.

[1] Commit d43c7fb05765 ("kunit: tool: fix improper treatment of file location")

Signed-off-by: SeongJae Park <sjpark@amazon.de>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
---
 tools/testing/kunit/kunit.py        | 6 +++---
 tools/testing/kunit/kunit_kernel.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 8bee2a5fee27..26046875adb2 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -45,7 +45,7 @@ class KunitStatus(Enum):
 	TEST_FAILURE = auto()
 
 def create_default_kunitconfig(build_dir=''):
-	kunitconfig = os.path.join(build_dir, kunit_kernel.kunitconfig_path)
+	kunitconfig = os.path.join(build_dir, kunit_kernel.KUNITCONFIG_PATH)
 	if not os.path.exists(kunitconfig):
 		shutil.copyfile('arch/um/configs/kunit_defconfig', kunitconfig)
 
@@ -259,7 +259,7 @@ def main(argv, linux=None):
 		os.chdir(get_kernel_root_path())
 
 	kunitconfig_path = os.path.join(cli_args.build_dir,
-			kunit_kernel.kunitconfig_path)
+			kunit_kernel.KUNITCONFIG_PATH)
 	if cli_args.subcommand == 'run':
 		if not os.path.exists(cli_args.build_dir):
 			os.mkdir(cli_args.build_dir)
@@ -285,7 +285,7 @@ def main(argv, linux=None):
 				not os.path.exists(cli_args.build_dir)):
 			os.mkdir(cli_args.build_dir)
 
-		if not os.path.exists(kunit_kernel.kunitconfig_path):
+		if not os.path.exists(kunitconfig_path):
 			create_default_kunitconfig(cli_args.build_dir)
 
 		if not linux:
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index 7dd4268665a8..f4bc9568bbce 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -18,7 +18,7 @@ import kunit_config
 import kunit_parser
 
 KCONFIG_PATH = '.config'
-kunitconfig_path = '.kunitconfig'
+KUNITCONFIG_PATH = '.kunitconfig'
 BROKEN_ALLCONFIG_PATH = 'tools/testing/kunit/configs/broken_on_uml.config'
 
 class ConfigError(Exception):
@@ -111,7 +111,7 @@ class LinuxSourceTree(object):
 
 	def __init__(self, build_dir):
 		self._kconfig = kunit_config.Kconfig()
-		self._kconfig.read_from_file(os.path.join(build_dir, kunitconfig_path))
+		self._kconfig.read_from_file(os.path.join(build_dir, KUNITCONFIG_PATH))
 		self._ops = LinuxSourceTreeOperations()
 		signal.signal(signal.SIGINT, self.signal_handler)
 
-- 
2.17.1


      parent reply	other threads:[~2020-10-22  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22  7:40 [PATCH v2 0/2] kunit: tool: Respect '.kunitconfig' in '--build_dir' SeongJae Park
2020-10-22  7:40 ` [PATCH v2 1/2] kunit: tool: Respect '.kunitconfig' in 'build_dir' SeongJae Park
2020-10-22  7:40 ` SeongJae Park [this message]

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=20201022074011.1990-3-sjpark@amazon.com \
    --to=sjpark@amazon.com \
    --cc=brendanhiggins@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sjpark@amazon.de \
    --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;
as well as URLs for NNTP newsgroup(s).