From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
From: SeongJae Park sjpark@amazon.de
The kunit doc suggests users to get the default `kunitconfig` from an external git tree. However, the file is already located under the `arch/um/configs/` of the kernel tree. Because the local file is easier to access and maintain, this commit updates the doc to use it.
Signed-off-by: SeongJae Park sjpark@amazon.de --- Documentation/dev-tools/kunit/start.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index aeeddfa..78a0aed 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -29,9 +29,8 @@ regular Kernel config, with the specific test targets as well.
.. code-block:: bash
- git clone -b master https://kunit.googlesource.com/kunitconfig $PATH_TO_KUNITCONFIG_REPO cd $PATH_TO_LINUX_REPO - ln -s $PATH_TO_KUNIT_CONFIG_REPO/kunitconfig kunitconfig + cp arch/um/configs/kunit_defconfig kunitconfig
You may want to add kunitconfig to your local gitignore.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit doc suggests users to get the default `kunitconfig` from an external git tree. However, the file is already located under the `arch/um/configs/` of the kernel tree. Because the local file is easier to access and maintain, this commit updates the doc to use it.
I agree; this probably makes more sense.
Signed-off-by: SeongJae Park sjpark@amazon.de
Reviewed-by: Brendan Higgins brendanhiggins@google.com
Thanks!
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Signed-off-by: SeongJae Park sjpark@amazon.de --- Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with: - -.. code-block:: bash - - ./tools/testing/kunit/kunit.py run - Creating a kunitconfig ====================== The Python script is a thin wrapper around Kbuild as such, it needs to be
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 6:25 PM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
I totally agree your way :)
Thanks, SeongJae Park
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 9:59 PM SeongJae Park sj38.park@gmail.com wrote:
On Mon, Dec 2, 2019 at 6:25 PM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
I totally agree your way :)
For the reason, I removed this patch from the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
Thanks, SeongJae Park
Thanks, SeongJae Park
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 9:25 AM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
I definitely agree that having a non-working command here is doing more harm than good. Whether we just get rid of it, or change it to use the --defconfig option is a matter of taste. (Personally, I think there's some value in having a one-line "run the tests" command at the top of the Getting Started page, but it definitely needs to be one that works.)
So, overall, I think this is definitely an improvement, but that we do need to choose whether to take this approach (deleting this command) or the --defconfig approach as in: https://lore.kernel.org/linux-kselftest/20191119003120.154041-1-brendanhiggi...
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
I generally think we want to keep the "Getting Started" guide focused on the goal (running/writing tests), rather than too much detail on the implementation (the wrapper itself). How about renaming what's currently the "KUnit Wrapper" section to "Running tests" or similar, and moving the kunitconfig part under that?
The "Creating a kunitconfig" part could equally be "configuring which tests to run" or something, which may speak more to motivating
As for some sort of tie-in, perhaps rewording the opening sentence to say "The easiest way to run tests is to use the kunit_tool script", and link to the page kunit_tool page in the patch below?
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
As above, my slight preference is for adding the --defconfig option over removing the section entirely.
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 9:25 AM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 10:03 PM David Gow davidgow@google.com wrote:
On Mon, Dec 2, 2019 at 9:25 AM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
I definitely agree that having a non-working command here is doing more harm than good. Whether we just get rid of it, or change it to use the --defconfig option is a matter of taste. (Personally, I think there's some value in having a one-line "run the tests" command at the top of the Getting Started page, but it definitely needs to be one that works.)
So, overall, I think this is definitely an improvement, but that we do need to choose whether to take this approach (deleting this command) or the --defconfig approach as in: https://lore.kernel.org/linux-kselftest/20191119003120.154041-1-brendanhiggi...
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
I generally think we want to keep the "Getting Started" guide focused on the goal (running/writing tests), rather than too much detail on the implementation (the wrapper itself). How about renaming what's currently the "KUnit Wrapper" section to "Running tests" or similar, and moving the kunitconfig part under that?
The "Creating a kunitconfig" part could equally be "configuring which tests to run" or something, which may speak more to motivating
As for some sort of tie-in, perhaps rewording the opening sentence to say "The easiest way to run tests is to use the kunit_tool script", and link to the page kunit_tool page in the patch below?
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
As above, my slight preference is for adding the --defconfig option over removing the section entirely.
Agree, I would also prefer to do explain about '--defconfig' option.
Thanks, SeongJae Park
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
On Mon, Dec 2, 2019 at 9:25 AM Brendan Higgins brendanhiggins@google.com wrote:
+David Gow - David has lots of good opinions on our documentation.
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
The kunit 'Getting Started' document first shows the wrapper running command. However, a new user who simply following the command might encounter a failure like below:
$ ./tools/testing/kunit/kunit.py run Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 126, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 85, in __init__ self._kconfig.read_from_file(KUNITCONFIG_PATH) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 65, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'kunitconfig'
Though the reason of the failure ('kunitconfig') is explained in its next section, it would be better to reduce any failure that user might encounter. This commit removes the example command for the reason.
Seems reasonable.
Signed-off-by: SeongJae Park sjpark@amazon.de
Documentation/dev-tools/kunit/start.rst | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 78a0aed..e25978d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,12 +15,6 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-The wrapper can be run with:
-.. code-block:: bash
- ./tools/testing/kunit/kunit.py run
Creating a kunitconfig
I think maybe we should demote this section so that this is a subsection under KUnit Wrapper. Might also want to add a tie-in explaining why we are talking about kunitconfig here? Right now this kind of reads as a non sequitur.
Note: we have tried to address this potential issue for new users in this patch under review:
https://patchwork.kernel.org/patch/11252953/
I don't feel strongly whether we do it your way or my way. What do other people think?
The Python script is a thin wrapper around Kbuild as such, it needs to be
2.7.4
From: SeongJae Park sjpark@amazon.de
'--defconfig' option is handled by the 'main() of the 'kunit.py' but again handled in following 'run_tests()'. This commit removes this duplicated handling of the option in the 'run_tests()'.
Signed-off-by: SeongJae Park sjpark@amazon.de --- tools/testing/kunit/kunit.py | 3 --- 1 file changed, 3 deletions(-)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index efe06d6..f8f2695 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -37,9 +37,6 @@ def create_default_kunitconfig():
def run_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitRequest) -> KunitResult: - if request.defconfig: - create_default_kunitconfig() - config_start = time.time() success = linux.build_reconfig(request.build_dir) config_end = time.time()
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
'--defconfig' option is handled by the 'main() of the 'kunit.py' but again handled in following 'run_tests()'. This commit removes this duplicated handling of the option in the 'run_tests()'.
Signed-off-by: SeongJae Park sjpark@amazon.de
Reviewed-by: Brendan Higgins brendanhiggins@google.com
Thanks!
From: SeongJae Park sjpark@amazon.de
If both '--build_dir' and '--defconfig' are given, the handling of '--defconfig' ignores '--build_dir' option. This commit modifies the behavior to respect '--build_dir' option.
Signed-off-by: SeongJae Park sjpark@amazon.de --- tools/testing/kunit/kunit.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index f8f2695..1746330 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -114,6 +114,11 @@ def main(argv, linux=None): cli_args = parser.parse_args(argv)
if cli_args.subcommand == 'run': + if cli_args.build_dir: + kunit_kernel.KUNITCONFIG_PATH = os.path.join( + cli_args.build_dir, + kunit_kernel.KUNITCONFIG_PATH) + if cli_args.defconfig: create_default_kunitconfig()
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
If both '--build_dir' and '--defconfig' are given, the handling of '--defconfig' ignores '--build_dir' option. This commit modifies the behavior to respect '--build_dir' option.
Signed-off-by: SeongJae Park sjpark@amazon.de
tools/testing/kunit/kunit.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index f8f2695..1746330 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -114,6 +114,11 @@ def main(argv, linux=None): cli_args = parser.parse_args(argv)
if cli_args.subcommand == 'run':
if cli_args.build_dir:
kunit_kernel.KUNITCONFIG_PATH = os.path.join(
If you are going to modify the value of KUNITCONFIG_PATH can you rename the variable to make it lower_snake_case? UPPER_SNAKE_CASE in Python is usually (at least in this directory) used to indicate the variable is a constant.
cli_args.build_dir,
kunit_kernel.KUNITCONFIG_PATH)
if cli_args.defconfig: create_default_kunitconfig()
-- 2.7.4
On Tue, Dec 3, 2019 at 7:41 AM Brendan Higgins brendanhiggins@google.com wrote:
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
If both '--build_dir' and '--defconfig' are given, the handling of '--defconfig' ignores '--build_dir' option. This commit modifies the behavior to respect '--build_dir' option.
Signed-off-by: SeongJae Park sjpark@amazon.de
tools/testing/kunit/kunit.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index f8f2695..1746330 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -114,6 +114,11 @@ def main(argv, linux=None): cli_args = parser.parse_args(argv)
if cli_args.subcommand == 'run':
if cli_args.build_dir:
kunit_kernel.KUNITCONFIG_PATH = os.path.join(
If you are going to modify the value of KUNITCONFIG_PATH can you rename the variable to make it lower_snake_case? UPPER_SNAKE_CASE in Python is usually (at least in this directory) used to indicate the variable is a constant.
Changed as you suggested in the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
Thanks, SeongJae Park
cli_args.build_dir,
kunit_kernel.KUNITCONFIG_PATH)
if cli_args.defconfig: create_default_kunitconfig()
-- 2.7.4
From: SeongJae Park sjpark@amazon.de
'kunit' writes the 'test.log' under the kernel source directory even though a 'build_dir' option is given. As users who use the option might expect the outputs to be placed under the specified directory, this commit modifies the logic to write the log file under the 'build_dir'.
Signed-off-by: SeongJae Park sjpark@amazon.de --- tools/testing/kunit/kunit_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index bf38768..b640939 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -143,7 +143,7 @@ class LinuxSourceTree(object): def run_kernel(self, args=[], timeout=None, build_dir=None): args.extend(['mem=256M']) process = self._ops.linux_bin(args, timeout, build_dir) - with open('test.log', 'w') as f: + with open(os.path.join(build_dir, 'test.log'), 'w') as f: for line in process.stdout: f.write(line.rstrip().decode('ascii') + '\n') yield line.rstrip().decode('ascii')
On Sun, Dec 1, 2019 at 3:25 PM SeongJae Park sj38.park@gmail.com wrote:
From: SeongJae Park sjpark@amazon.de
'kunit' writes the 'test.log' under the kernel source directory even though a 'build_dir' option is given. As users who use the option might expect the outputs to be placed under the specified directory, this commit modifies the logic to write the log file under the 'build_dir'.
Good idea!
Signed-off-by: SeongJae Park sjpark@amazon.de
Reviewed-by: Brendan Higgins brendanhiggins@google.com
Thanks!
From: SeongJae Park sjpark@amazon.de
This commit renames 'kunitconfig' to '.kunitconfig' so that it can be automatically ignored by git and do not disturb people who want to type 'kernel/' by pressing only the 'k' and then 'tab' key.
Signed-off-by: SeongJae Park sjpark@amazon.de --- Documentation/dev-tools/kunit/start.rst | 12 +++++------- tools/testing/kunit/kunit.py | 2 +- tools/testing/kunit/kunit_kernel.py | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index e25978d..f2e585e 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -15,18 +15,16 @@ Included with KUnit is a simple Python wrapper that helps format the output to easily use and read KUnit output. It handles building and running the kernel, as well as formatting the output.
-Creating a kunitconfig -====================== +Creating a .kunitconfig +======================= The Python script is a thin wrapper around Kbuild as such, it needs to be -configured with a ``kunitconfig`` file. This file essentially contains the +configured with a ``.kunitconfig`` file. This file essentially contains the regular Kernel config, with the specific test targets as well.
.. code-block:: bash
cd $PATH_TO_LINUX_REPO - cp arch/um/configs/kunit_defconfig kunitconfig - -You may want to add kunitconfig to your local gitignore. + cp arch/um/configs/kunit_defconfig .kunitconfig
Verifying KUnit Works --------------------- @@ -141,7 +139,7 @@ and the following to ``drivers/misc/Makefile``:
obj-$(CONFIG_MISC_EXAMPLE_TEST) += example-test.o
-Now add it to your ``kunitconfig``: +Now add it to your ``.kunitconfig``:
.. code-block:: none
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index 1746330..309d6e3 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -108,7 +108,7 @@ def main(argv, linux=None): type=str, default=None, metavar='build_dir')
run_parser.add_argument('--defconfig', - help='Uses a default kunitconfig.', + help='Uses a default .kunitconfig.', action='store_true')
cli_args = parser.parse_args(argv) diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index b640939..507364d 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -14,7 +14,7 @@ import os import kunit_config
KCONFIG_PATH = '.config' -KUNITCONFIG_PATH = 'kunitconfig' +KUNITCONFIG_PATH = '.kunitconfig'
class ConfigError(Exception): """Represents an error trying to configure the Linux kernel.""" @@ -111,7 +111,7 @@ class LinuxSourceTree(object): return True
def build_reconfig(self, build_dir): - """Creates a new .config if it is not a subset of the kunitconfig.""" + """Creates a new .config if it is not a subset of the .kunitconfig.""" kconfig_path = get_kconfig_path(build_dir) if os.path.exists(kconfig_path): existing_kconfig = kunit_config.Kconfig()
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Cheers!
On Tue, Dec 3, 2019 at 8:00 AM Brendan Higgins brendanhiggins@google.com wrote:
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Thank you for sharing this. I will take a look!
Thanks, SeongJae Park
Cheers!
You're right, the error was due to the assumption of the existence of the build_dir. The "kunit: Create default config in '--build_dir'" patch made the bug. I fixed it in the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
Thanks, SeongJae Park
On Tue, Dec 3, 2019 at 8:10 AM SeongJae Park sj38.park@gmail.com wrote:
On Tue, Dec 3, 2019 at 8:00 AM Brendan Higgins brendanhiggins@google.com wrote:
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Thank you for sharing this. I will take a look!
Thanks, SeongJae Park
Cheers!
On Tue, Dec 3, 2019 at 12:26 AM SeongJae Park sj38.park@gmail.com wrote:
You're right, the error was due to the assumption of the existence of the build_dir. The "kunit: Create default config in '--build_dir'" patch made the bug. I fixed it in the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
After trying your new patches, I am still getting the "FileNotFoundError" when the given build_dir has not been created.
Thanks, SeongJae Park
On Tue, Dec 3, 2019 at 8:10 AM SeongJae Park sj38.park@gmail.com wrote:
On Tue, Dec 3, 2019 at 8:00 AM Brendan Higgins brendanhiggins@google.com wrote:
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Thank you for sharing this. I will take a look!
Thanks, SeongJae Park
Cheers!
On Tue, Dec 3, 2019 at 6:45 PM Brendan Higgins brendanhiggins@google.com wrote:
On Tue, Dec 3, 2019 at 12:26 AM SeongJae Park sj38.park@gmail.com wrote:
You're right, the error was due to the assumption of the existence of the build_dir. The "kunit: Create default config in '--build_dir'" patch made the bug. I fixed it in the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
After trying your new patches, I am still getting the "FileNotFoundError" when the given build_dir has not been created.
Sorry, apparently my mistake... Sent v3 fixing it: https://lore.kernel.org/linux-kselftest/1575396508-21480-1-git-send-email-sj...
Thanks, SeongJae Park
Thanks, SeongJae Park
On Tue, Dec 3, 2019 at 8:10 AM SeongJae Park sj38.park@gmail.com wrote:
On Tue, Dec 3, 2019 at 8:00 AM Brendan Higgins brendanhiggins@google.com wrote:
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Thank you for sharing this. I will take a look!
Thanks, SeongJae Park
Cheers!
On Tue, Dec 3, 2019 at 10:11 AM SeongJae Park sj38.park@gmail.com wrote:
On Tue, Dec 3, 2019 at 6:45 PM Brendan Higgins brendanhiggins@google.com wrote:
On Tue, Dec 3, 2019 at 12:26 AM SeongJae Park sj38.park@gmail.com wrote:
You're right, the error was due to the assumption of the existence of the build_dir. The "kunit: Create default config in '--build_dir'" patch made the bug. I fixed it in the second version patchset[1].
[1] https://lore.kernel.org/linux-doc/1575361141-6806-1-git-send-email-sj38.park...
After trying your new patches, I am still getting the "FileNotFoundError" when the given build_dir has not been created.
Sorry, apparently my mistake... Sent v3 fixing it: https://lore.kernel.org/linux-kselftest/1575396508-21480-1-git-send-email-sj...
Awesome, looks like that works now!
Thanks for taking care of this!
Thanks, SeongJae Park
Thanks, SeongJae Park
On Tue, Dec 3, 2019 at 8:10 AM SeongJae Park sj38.park@gmail.com wrote:
On Tue, Dec 3, 2019 at 8:00 AM Brendan Higgins brendanhiggins@google.com wrote:
On Mon, Dec 02, 2019 at 08:25:18AM +0900, SeongJae Park wrote:
From: SeongJae Park sjpark@amazon.de
This patchset contains trivial fixes for the kunit documentations and the wrapper python scripts.
SeongJae Park (6): docs/kunit/start: Use in-tree 'kunit_defconfig' docs/kunit/start: Skip wrapper run command kunit: Remove duplicated defconfig creation kunit: Create default config in 'build_dir' kunit: Place 'test.log' under the 'build_dir' kunit: Rename 'kunitconfig' to '.kunitconfig'
Documentation/dev-tools/kunit/start.rst | 19 +++++-------------- tools/testing/kunit/kunit.py | 10 ++++++---- tools/testing/kunit/kunit_kernel.py | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-)
I applied your patchset to torvalds/master, ran the command:
tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit
and got the error:
Traceback (most recent call last): File "tools/testing/kunit/kunit.py", line 140, in <module> main(sys.argv[1:]) File "tools/testing/kunit/kunit.py", line 123, in main create_default_kunitconfig() File "tools/testing/kunit/kunit.py", line 36, in create_default_kunitconfig kunit_kernel.KUNITCONFIG_PATH) File "/usr/lib/python3.7/shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '.kunit/.kunitconfig'
It seems that it expects the build_dir to already exist; however, I don't think this is clear from the error message. Would you mind addressing that here?
Thank you for sharing this. I will take a look!
Thanks, SeongJae Park
Cheers!
linux-kselftest-mirror@lists.linaro.org