<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/tools/testing/kunit, branch v5.10.230</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.10.230</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.10.230'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-05-22T09:40:55Z</updated>
<entry>
<title>tweewide: Fix most Shebang lines</title>
<updated>2021-05-22T09:40:55Z</updated>
<author>
<name>Finn Behrens</name>
<email>me@kloenk.de</email>
</author>
<published>2020-11-23T14:15:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6ae514b8a8eb675df9d746693726a72d46f2391d'/>
<id>urn:sha1:6ae514b8a8eb675df9d746693726a72d46f2391d</id>
<content type='text'>
commit c25ce589dca10d64dde139ae093abc258a32869c upstream.

Change every shebang which does not need an argument to use /usr/bin/env.
This is needed as not every distro has everything under /usr/bin,
sometimes not even bash.

Signed-off-by: Finn Behrens &lt;me@kloenk.de&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: Fix a python tuple typing error</title>
<updated>2021-04-10T11:36:08Z</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2021-02-23T05:49:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4ca265610cc6d1eee7d4aa8690a4ae6072bd5825'/>
<id>urn:sha1:4ca265610cc6d1eee7d4aa8690a4ae6072bd5825</id>
<content type='text'>
[ Upstream commit 7421b1a4d10c633ca5f14c8236d3e2c1de07e52b ]

The first argument to namedtuple() should match the name of the type,
which wasn't the case for KconfigEntryBase.

Fixing this is enough to make mypy show no python typing errors again.

Fixes 97752c39bd ("kunit: kunit_tool: Allow .kunitconfig to disable config items")
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Daniel Latypov &lt;dlatypov@google.com&gt;
Acked-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: fix unit test cleanup handling</title>
<updated>2021-03-04T10:38:05Z</updated>
<author>
<name>Daniel Latypov</name>
<email>dlatypov@google.com</email>
</author>
<published>2020-12-02T19:08:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ecb23b97a70b89054926dbf87e1bd22864236a1a'/>
<id>urn:sha1:ecb23b97a70b89054926dbf87e1bd22864236a1a</id>
<content type='text'>
[ Upstream commit cfd607e43da4a20753744f134e201310262b827a ]

* Stop leaking file objects.
* Use self.addCleanup() to ensure we call cleanup functions even if
setUp() fails.
* use mock.patch.stopall instead of more error-prone manual approach

Signed-off-by: Daniel Latypov &lt;dlatypov@google.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Acked-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: fix extra trailing \n in raw + parsed test output</title>
<updated>2020-11-10T20:44:35Z</updated>
<author>
<name>Daniel Latypov</name>
<email>dlatypov@google.com</email>
</author>
<published>2020-10-30T22:38:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=060352e141e4c71ce147a2737f6d30a97f2ec317'/>
<id>urn:sha1:060352e141e4c71ce147a2737f6d30a97f2ec317</id>
<content type='text'>
For simplcity, strip all trailing whitespace from parsed output.
I imagine no one is printing out meaningful trailing whitespace via
KUNIT_FAIL() or similar, and that if they are, they really shouldn't.

`isolate_kunit_output()` yielded liens with trailing \n, which results
in artifacty output like this:

$ ./tools/testing/kunit/kunit.py run
[16:16:46] [FAILED] example_simple_test
[16:16:46]     # example_simple_test: EXPECTATION FAILED at lib/kunit/kunit-example-test.c:29

[16:16:46]     Expected 1 + 1 == 3, but

[16:16:46]         1 + 1 == 2

[16:16:46]         3 == 3

[16:16:46]     not ok 1 - example_simple_test

[16:16:46]

After this change:
[16:16:46]     # example_simple_test: EXPECTATION FAILED at lib/kunit/kunit-example-test.c:29
[16:16:46]     Expected 1 + 1 == 3, but
[16:16:46]         1 + 1 == 2
[16:16:46]         3 == 3
[16:16:46]     not ok 1 - example_simple_test
[16:16:46]

We should *not* be expecting lines to end with \n in kunit_tool_test.py
for this reason.

Do the same for `raw_output()` as well which suffers from the same
issue.

This is a followup to [1], but rebased onto kunit-fixes to pick up the
other raw_output() fix and fixes for kunit_tool_test.py.

[1] https://lore.kernel.org/linux-kselftest/20201020233219.4146059-1-dlatypov@google.com/

Signed-off-by: Daniel Latypov &lt;dlatypov@google.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Tested-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: print out stderr from make (like build warnings)</title>
<updated>2020-11-10T20:43:22Z</updated>
<author>
<name>Daniel Latypov</name>
<email>dlatypov@google.com</email>
</author>
<published>2020-10-29T22:09:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=390881448b1ff1e9d82896abbbda7cdb8e0be27c'/>
<id>urn:sha1:390881448b1ff1e9d82896abbbda7cdb8e0be27c</id>
<content type='text'>
Currently the tool redirects make stdout + stderr, and only shows them
if the make command fails.
This means build warnings aren't shown to the user.

This change prints the contents of stderr even if make succeeds, under
the assumption these are only build warnings or other messages the user
likely wants to see.

We drop stdout from the raised exception since we can no longer easily
collate stdout and stderr and just showing the stderr seems fine.

Example with a warning:

[14:56:35] Building KUnit Kernel ...
../lib/kunit/kunit-test.c: In function ‘kunit_test_successful_try’:
../lib/kunit/kunit-test.c:19:6: warning: unused variable ‘unused’ [-Wunused-variable]
   19 |  int unused;
      |      ^~~~~~

[14:56:40] Starting KUnit Kernel ...

Note the stderr has a trailing \n, and since we use print, we add
another, but it helps separate make and kunit.py output.

Example with a build error:

[15:02:45] Building KUnit Kernel ...
ERROR:root:../lib/kunit/kunit-test.c: In function ‘kunit_test_successful_try’:
../lib/kunit/kunit-test.c:19:2: error: unknown type name ‘invalid_type’
   19 |  invalid_type *test = data;
      |  ^~~~~~~~~~~~
...

Signed-off-by: Daniel Latypov &lt;dlatypov@google.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: Do not pollute source directory with generated files (test.log)</title>
<updated>2020-11-10T20:31:16Z</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2020-10-26T16:59:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=128dc4bcc8c0c7c3bab4a3818a1ec608cccb017a'/>
<id>urn:sha1:128dc4bcc8c0c7c3bab4a3818a1ec608cccb017a</id>
<content type='text'>
When --build_dir is provided use it and do not pollute source directory
which even can be mounted over network or read-only.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Tested-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: Do not pollute source directory with generated files (.kunitconfig)</title>
<updated>2020-11-10T20:12:54Z</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2020-10-26T16:59:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fcdb0bc08ced274078f371e1e0fe6421a97fa9f2'/>
<id>urn:sha1:fcdb0bc08ced274078f371e1e0fe6421a97fa9f2</id>
<content type='text'>
When --build_dir is provided use it and do not pollute source directory
which even can be mounted over network or read-only.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Tested-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: fix pre-existing python type annotation errors</title>
<updated>2020-11-10T20:11:28Z</updated>
<author>
<name>Daniel Latypov</name>
<email>dlatypov@google.com</email>
</author>
<published>2020-10-21T22:07:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b7e0b983ff13714d261883e89910b0755eb12169'/>
<id>urn:sha1:b7e0b983ff13714d261883e89910b0755eb12169</id>
<content type='text'>
The code uses annotations, but they aren't accurate.
Note that type checking in python is a separate process, running
`kunit.py run` will not check and complain about invalid types at
runtime.

Fix pre-existing issues found by running a type checker
$ mypy *.py

All but one of these were returning `None` without denoting this
properly (via `Optional[Type]`).

Signed-off-by: Daniel Latypov &lt;dlatypov@google.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: Fix kunit.py parse subcommand (use null build_dir)</title>
<updated>2020-11-10T20:09:15Z</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2020-10-21T07:16:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3959d0a63b3202ea2aa12b3f6effd5400d773d31'/>
<id>urn:sha1:3959d0a63b3202ea2aa12b3f6effd5400d773d31</id>
<content type='text'>
When JSON support was added in [1], the KunitParseRequest tuple was
updated to contain a 'build_dir' field, but kunit.py parse doesn't
accept --build_dir as an option. The code nevertheless tried to access
it, resulting in this error:

AttributeError: 'Namespace' object has no attribute 'build_dir'

Given that the parser only uses the build_dir variable to set the
'build_environment' json field, we set it to None (which gives the JSON
'null') for now. Ultimately, we probably do want to be able to set this,
but since it's new functionality which (for the parse subcommand) never
worked, this is the quickest way of getting it back up and running.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&amp;id=21a6d1780d5bbfca0ce9b8104ca6233502fcbf86

Fixes: 21a6d1780d5b ("kunit: tool: allow generating test results in JSON")
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Tested-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kunit: tool: unmark test_data as binary blobs</title>
<updated>2020-11-10T19:59:01Z</updated>
<author>
<name>Brendan Higgins</name>
<email>brendanhiggins@google.com</email>
</author>
<published>2020-11-05T23:24:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c335b4f1f65012713832d988ec06512c7bda5c04'/>
<id>urn:sha1:c335b4f1f65012713832d988ec06512c7bda5c04</id>
<content type='text'>
The tools/testing/kunit/test_data/ directory was marked as binary
because some of the test_data files cause checkpatch warnings. Fix this
by dropping the .gitattributes file.

Fixes: afc63da64f1e ("kunit: kunit_parser: make parser more robust")
Signed-off-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
