- 18 May, 2022 1 commit
-
-
David Gow authored
We're currently using the x86_64 qemu for i386 builds. While this is not incorrect, it's probably more sensible to use the i386 one, which will at least fail properly if we accidentally were to build a 64-bit kernel. Signed-off-by:
David Gow <davidgow@google.com> Tested-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 17 May, 2022 1 commit
-
-
Daniel Latypov authored
The existing logic happens to work fine on UML, but is not correct when running on other arches. 1. We didn't initialize `int err`, and kunit_filter_suites() doesn't explicitly set it to 0 on success. So we had false "failures". Note: it doesn't happen on UML, causing this to get overlooked. 2. If we error out, we do not call kunit_handle_shutdown(). This makes kunit.py timeout when using a non-UML arch, since the QEMU process doesn't ever exit. Fixes: a02353f4 ("kunit: bail out of test filtering logic quicker if OOM") Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 16 May, 2022 8 commits
-
-
Brendan Higgins authored
The config for the serial console for riscv, CONFIG_SERIAL_EARLYCON_RISCV_SBI, added a dependency, CONFIG_RISCV_SBI_V01, at some point, so add that in to the base arch config. Signed-off-by:
Brendan Higgins <brendanhiggins@google.com> Reviewed-by:
David Gow <davidgow@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Marco Elver authored
Use the newly added suite_{init,exit} support for suite-wide init and cleanup. This avoids the unsupported method by which the test used to do suite-wide init and cleanup (avoiding issues such as missing TAP headers, and possible future conflicts). Signed-off-by:
Marco Elver <elver@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
David Gow authored
It's often desirable (particularly in test automation) to run as many tests as possible. This config enables all the tests which work as builtins under UML at present, increasing the total tests run from 156 to 342 (not counting 36 'skipped' tests). They can be run with: ./tools/testing/kunit/kunit.py run --kunitconfig=./tools/testing/kunit/configs/all_tests_uml.config This acts as an in-between point between the KUNIT_ALL_TESTS config (which enables only tests whose dependencies are already enabled), and the kunit_tool --alltests option, which tries to use allyesconfig, taking a very long time to build and breaking very often. Signed-off-by:
David Gow <davidgow@google.com> Tested-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Miguel Ojeda authored
The `kunit_do_failed_assertion` function passes its `struct kunit_assert` argument to `kunit_fail`. This one, in turn, calls its `format` field passing the assert again as a `const` pointer. Therefore, the whole chain may be made `const`. Signed-off-by:
Miguel Ojeda <ojeda@kernel.org> Reviewed-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Kees Cook <keescook@chromium.org> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
This primarily comes from running pylint over kunit tool code and ignoring some warnings we don't care about. If we ever got a fully clean setup, we could add this to run_checks.py, but we're not there yet. Fix things like * Drop unused imports * check `is None`, not `== None` (see PEP 8) * remove redundant parens around returns * remove redundant `else` / convert `elif` to `if` where appropriate * rename make_arch_qemuconfig() param to base_kunitconfig (this is the name used in the subclass, and it's a better one) * kunit_tool_test: check the exit code for SystemExit (could be 0) Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
There should be no behavioral changes from this patch. This patch removes redundant comment text, inlines a function used in only one place, and other such minor tweaks. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Consider this invocation $ ./tools/testing/kunit/kunit.py parse <<EOF TAP version 14 1..2 ok 1 - suite # Subtest: no_tests_suite # catastrophic error! not ok 1 - no_tests_suite EOF It will have a 0 exit code even though there's a "not ok". Consider this one: $ ./tools/testing/kunit/kunit.py parse <<EOF TAP version 14 1..2 ok 1 - suite not ok 1 - no_tests_suite EOF It will a non-zero exit code. Why? We have this line in the kunit_parser.py > parent_test = parse_test_header(lines, test) where we have special handling when we see "# Subtest" and we ignore the explicit reported "not ok 1" status! Also, NO_TESTS at a suite-level only results in a non-zero status code where then there's only one suite atm. This change is the minimal one to make sure we don't overwrite it. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
This logic depends on the kernel logging a message containing 'kunit test case crashed', but there is no corresponding logic to do so. This is likely a relic of the revision process KUnit initially went through when being upstreamed. Delete it given 1) it's been missing for years and likely won't get implemented 2) the parser has been moving to be a more general KTAP parser, kunit-only magic like this isn't how we'd want to implement it. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 12 May, 2022 6 commits
-
-
Daniel Latypov authored
Before: $ ./tools/testing/kunit/kunit.py parse /dev/null ... [ERROR] Test : invalid KTAP input! After: $ ./tools/testing/kunit/kunit.py parse /dev/null ... [ERROR] Test <missing>: could not find any KTAP output! This error message gets printed out when extract_tap_output() yielded no lines. So while it could be because of malformed KTAP output from KUnit, it could also be due to not having any KTAP output at all. Try and make the error message here more clear. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Note: this potentially breaks custom qemu_configs if people are using them! But the fix for them is simple, don't specify multiple arguments in one string and don't add on a redundant ''. It feels a bit iffy to be using a shell in the first place. There's the usual shenanigans where people could pass in arbitrary shell commands via --kernel_arg (since we're just adding '' around the kernel_cmdline) or via a custom qemu_config. This isn't too much of a concern given the nature of this script (and the qemu_config file is in python, you can do w/e you want already). But it does have some other drawbacks. One example of a kunit-specific pain point: If the relevant qemu binary is missing, we get output like this: > /bin/sh: line 1: qemu-system-aarch64: command not found This in turn results in our KTAP parser complaining about missing/invalid KTAP, but we don't directly show the error! It's even more annoying to debug when you consider --raw_output only shows KUnit output by default, i.e. you need --raw_output=all to see it. Whereas directly invoking the binary, Python will raise a FileNotFoundError for us, which is a noisier but more clear. Making this change requires * splitting parameters like ['-m 256'] into ['-m', '256'] in kunit/qemu_configs/*.py * change [''] to [] in kunit/qemu_configs/*.py since otherwise QEMU fails w/ 'Device needs media, but drive is empty' * dropping explicit quoting of the kernel cmdline * using shlex.quote() when we print what command we're running so the user can copy-paste and run it Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Before: > Testing complete. Passed: 137, Failed: 0, Crashed: 0, Skipped: 36, Errors: 0 After: > Testing complete. Ran 173 tests: passed: 137, skipped: 36 Even with our current set of statuses, the output is a bit verbose. It could get worse in the future if we add more (e.g. timeout, kasan). Let's only print the relevant ones. I had previously been sympathetic to the argument that always printing out all the statuses would make it easier to parse results. But now we have commit acd8e840 ("kunit: Print test statistics on failure"), there are test counts printed out in the raw output. We don't currently print out an overall total across all suites, but it would be easy to add, if we see a need for that. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Co-developed-by:
David Gow <davidgow@google.com> Signed-off-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
When filtering what tests to run (suites and/or cases) via kunit.filter_glob (e.g. kunit.py run <glob>), we allocate copies of suites. These allocations can fail, and we largely don't handle that. Note: realistically, this probably doesn't matter much. We're not allocating much memory and this happens early in boot, so if we can't do that, then there's likely far bigger problems. This patch makes us immediately bail out from the top-level function (kunit_filter_suites) with -ENOMEM if any of the underlying kmalloc() calls return NULL. Implementation note: we used to return NULL pointers from some functions to indicate either that all suites/tests were filtered out or there was an error allocating the new array. We'll log a short error in this case and not run any tests or print a TAP header. From a kunit.py user's perspective, they'll get a message about missing/invalid TAP output and have to dig into the test.log to see it. Since hitting this error seems so unlikely, it's probably fine to not invent a way to plumb this error message more visibly. See also: https://lore.kernel.org/linux-kselftest/20220329103919.2376818-1-lv.ruyi@zte.com.cn/Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reported-by:
Zeal Robot <zealci@zte.com.cn> Reported-by:
Lv Ruyi <lv.ruyi@zte.com.cn> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
This is in line with Documentation/dev-tools/kunit/style.rst. Some of these tests predate that so they don't follow this convention. With this and commit b0841b51 ("kunit: arch/um/configs: Enable KUNIT_ALL_TESTS by default"), kunit.py will now run these tests by default. This hopefully makes it easier to run and maintain the tests. If any of these were to start failing, people would notice much quicker. Note: this commit doesn't update LINEAR_RANGES_TEST since that would select its dependency (LINEAR_RANGES). We don't want KUNIT_ALL_TESTS to enable anything other than test kconfigs. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Nico Pache <npache@redhat.com> Acked-by:
Nico Pache <npache@redhat.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
David Gow authored
KUnit's test-managed resources can be created in two ways: - Using the kunit_add_resource() family of functions, which accept a struct kunit_resource pointer, typically allocated statically or on the stack during the test. - Using the kunit_alloc_resource() family of functions, which allocate a struct kunit_resource using kzalloc() behind the scenes. Both of these families of functions accept a 'free' function to be called when the resource is finally disposed of. At present, KUnit will kfree() the resource if this 'free' function is specified, and will not if it is NULL. However, this can lead kunit_alloc_resource() to leak memory (if no 'free' function is passed in), or kunit_add_resource() to incorrectly kfree() memory which was allocated by some other means (on the stack, as part of a larger allocation, etc), if a 'free' function is provided. Instead, always kfree() if the resource was allocated with kunit_alloc_resource(), and never kfree() if it was passed into kunit_add_resource() by the user. (If the user of kunit_add_resource() wishes the resource be kfree()ed, they can call kfree() on the resource from within the 'free' function. This is implemented by adding a 'should_free' member to struct kunit_resource and setting it appropriately. To facilitate this, the various resource add/alloc functions have been refactored somewhat, making them all call a __kunit_add_resource() helper after setting the 'should_free' member appropriately. In the process, all other functions have been made static inline functions. Signed-off-by:
David Gow <davidgow@google.com> Tested-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 02 May, 2022 4 commits
-
-
Daniel Latypov authored
Commit 6d2426b2 ("kunit: Support skipped tests") switched to using `enum kunit_status` to track the result of running a test/suite since we now have more than just pass/fail. This callsite wasn't updated, silently converting to enum to a bool and then back. Fixes: 6d2426b2 ("kunit: Support skipped tests") Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Currently, the kfence test suite could not run via "normal" means since KUnit didn't support per-suite setup/teardown. So it manually called internal kunit functions to run itself. This has some downsides, like missing TAP headers => can't use kunit.py to run or even parse the test results (w/o tweaks). Use the newly added support and convert it over, adding a .kunitconfig so it's even easier to run from kunit.py. People can now run the test via $ ./tools/testing/kunit/kunit.py run --kunitconfig=mm/kfence --arch=x86_64 ... [11:02:32] Testing complete. Passed: 23, Failed: 0, Crashed: 0, Skipped: 2, Errors: 0 [11:02:32] Elapsed time: 43.562s total, 0.003s configuring, 9.268s building, 34.281s running Cc: kasan-dev@googlegroups.com Signed-off-by:
Daniel Latypov <dlatypov@google.com> Tested-by:
David Gow <davidgow@google.com> Reviewed-by:
Marco Elver <elver@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
KUnit has support for setup/cleanup logic for each test case in a suite. But it lacks the ability to specify setup/cleanup for the entire suite itself. This can be used to do setup that is too expensive or cumbersome to do for each test. Or it can be used to do simpler things like log debug information after the suite completes. It's a fairly common feature, so the lack of it is noticeable. Some examples in other frameworks and languages: * https://docs.python.org/3/library/unittest.html#setupclass-and-teardownclass * https://google.github.io/googletest/reference/testing.html#Test::SetUpTestSuite Meta: This is very similar to this patch here: https://lore.kernel.org/linux-kselftest/20210805043503.20252-3-bvanassche@acm.org/ The changes from that patch: * pass in `struct kunit *` so users can do stuff like `kunit_info(suite, "debug message")` * makes sure the init failure is bubbled up as a failure * updates kunit-example-test.c to use a suite init * Updates kunit/usage.rst to mention the new support * some minor cosmetic things * use `suite_{init,exit}` instead of `{init/exit}_suite` * make suite init error message more consistent w/ test init * etc. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
These names sound more general than they are. The _end() function increments a `static int kunit_suite_counter`, so it can only safely be called on suites, aka top-level subtests. It would need to have a separate counter for each level of subtest to be generic enough. So rename it to make it clear it's only appropriate for suites. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 27 Apr, 2022 1 commit
-
-
Brendan Higgins authored
Add support for a new kind of kunit_suite registration macro called kunit_test_init_section_suite(); this new registration macro allows the registration of kunit_suites that reference functions marked __init and data marked __initdata. Signed-off-by:
Brendan Higgins <brendanhiggins@google.com> Tested-by:
Martin Fernandez <martin.fernandez@eclypsium.com> Reviewed-by:
Kees Cook <keescook@chromium.org> Reviewed-by:
David Gow <davidgow@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 05 Apr, 2022 2 commits
-
-
David Gow authored
The kunit_remove_resource() function is used to unlink a resource from the list of resources in the test, making it no longer show up in kunit_find_resource(). However, this could lead to a race condition if two threads called kunit_remove_resource() on the same resource at the same time: the resource would be removed from the list twice (causing a crash at the second list_del()), and the refcount for the resource would be decremented twice (instead of once, for the reference held by the resource list). Fix both problems, the first by using list_del_init(), and the second by checking if the resource has already been removed using list_empty(), and only decrementing its refcount if it has not. Also add a KUnit test for the kunit_remove_resource() function which tests this behaviour. Reported-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
David Gow authored
Add KUnit tests to the hlist linked-list structure which is used by hashtables. This should give coverage of every function and macro in list.h, as well as (combined with the KUnit tests for the hash functions) get very close to having tests for the hashtable structure. The tests here mirror the existing list tests, and are found in a new suite titled 'hlist'. Signed-off-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
- 04 Apr, 2022 17 commits
-
-
Daniel Latypov authored
Recent changes have made it so the current set is not sufficient. Namely, CONFIG_DEBUG_INFO is not being set even when explicitly asked. Specifying a version of the debug info fixes this. Pick CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT as an option that's hopefully less fragile (esp. given we're tied to GCC 6 and lower). Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Tested-by:
Maxime Ripard <maxime@cerno.tech> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
We've split out the declarations from include/kunit/test.h into resource.h. This patch splits out the definitions as well for consistency. A side effect of this is git blame won't properly track history by default, users need to run $ git blame -L ,1 -C13 lib/kunit/resource.c Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Background: Currently, a reader looking at kunit/test.h will find the file is quite long, and the first meaty comment is a doc comment about struct kunit_resource. Most users will not ever use the KUnit resource API directly. They'll use kunit_kmalloc() and friends, or decide it's simpler to do cleanups via labels (it often can be) instead of figuring out how to use the API. It's also logically separate from everything else in test.h. Removing it from the file doesn't cause any compilation errors (since struct kunit has `struct list_head resources` to store them). This commit: Let's move it into a kunit/resource.h file and give it a separate page in the docs, kunit/api/resource.rst. We include resource.h at the bottom of test.h since * don't want to force existing users to add a new include if they use the API * it accesses `lock` inside `struct kunit` in a inline func * so we can't just forward declare, and the alternatives require uninlining the func, adding hepers to lock/unlock, or other more invasive changes. Now the first big comment in test.h is about kunit_case, which is a lot more relevant to what a new user wants to know. A side effect of this is git blame won't properly track history by default, users need to run $ git blame -L ,1 -C17 include/kunit/resource.h Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Before, our help output contained lines like --kconfig_add KCONFIG_ADD --qemu_config qemu_config --jobs jobs They're not very helpful. The former kind come from the automatic 'metavar' we get from argparse, the uppercase version of the flag name. The latter are where we manually specified metavar as the flag name. After: --build_dir DIR --make_options X=Y --kunitconfig PATH --kconfig_add CONFIG_X=Y --arch ARCH --cross_compile PREFIX --qemu_config FILE --jobs N --timeout SECONDS --raw_output [{all,kunit}] --json [FILE] This patch tries to make the code more clear by specifying the _type_ of input we expect, e.g. --build_dir is a DIR, --qemu_config is a FILE. I also switched it to uppercase since it looked more clearly like placeholder text that way. This patch also changes --raw_output to specify `choices` to make it more clear what the options are, and this way argparse can validate it for us, as shown by the added test case. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Kees Cook authored
Filling log files with color codes makes diffs and other comparisons difficult. Only emit vt100 codes when the stdout is a TTY. Cc: Brendan Higgins <brendanhiggins@google.com> Cc: linux-kselftest@vger.kernel.org Cc: kunit-dev@googlegroups.com Signed-off-by:
Kees Cook <keescook@chromium.org> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Before, kunit.py always printed "arch": "UM" in its json output, but... 1. With `kunit.py parse`, we could be parsing output from anywhere, so we can't say that. 2. Capitalizing it is probably wrong, as it's `ARCH=um` 3. Commit 87c9c163 ("kunit: tool: add support for QEMU") made it so kunit.py could knowingly run a different arch, yet we'd still always claim "UM". This patch addresses all of those. E.g. 1. $ ./tools/testing/kunit/kunit.py parse .kunit/test.log --json | grep -o '"arch.*' | sort -u "arch": "", 2. $ ./tools/testing/kunit/kunit.py run --json | ... "arch": "um", 3. $ ./tools/testing/kunit/kunit.py run --json --arch=x86_64 | ... "arch": "x86_64", Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
When using --json, kunit.py run/exec/parse will produce results in KernelCI json format. As part of that, we include the build_dir that was used, and we (incorrectly) hardcode in the arch, etc. We'll want a way to plumb more values (as well as the correct `arch`), so this patch groups those fields into kunit_json.Metadata type. This patch should have no user visible changes. And since we only used build_dir in KunitParseRequest for json, we can now move it out of that struct and add it into KunitExecRequest, which needs it and used to get it via inheritance. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Use a more idiomatic check that a list is non-empty (`if mylist:`) and simplify the function body by dedenting and using a dict to map between the kunit TestStatus enum => KernelCI json status string. The dict hopefully makes it less likely to have bugs like commit 9a6bb30a ("kunit: tool: fix --json output for skipped tests"). Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Replace the PTR_EQ NULL checks with the more idiomatic and specific NULL macros. Acked-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Acked-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Replace the PTR_EQ NULL checks wit the NULL macros. More idiomatic and specific. Acked-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Acked-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Replace PTR_EQ checks with the more idiomatic and specific NULL macros. Acked-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Acked-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Replace the NULL checks with the more specific and idiomatic NULL macros. Acked-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Acked-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Replace the NULL checks with the more specific and idiomatic NULL macros. Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Reviewed-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Ricardo Ribalda authored
Today, when we want to check if a pointer is NULL and not ERR we have two options: KUNIT_EXPECT_TRUE(test, ptr == NULL); or KUNIT_EXPECT_PTR_NE(test, ptr, (struct mystruct *)NULL); Create a new set of macros that take care of NULL checks. Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Reviewed-by:
Daniel Latypov <dlatypov@google.com> Signed-off-by:
Ricardo Ribalda <ribalda@chromium.org> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
--build_dir is set to a default of '.kunit' since commit ddbd60c7 ("kunit: use --build_dir=.kunit as default"), but even before then it was explicitly set to ''. So outside of one unit test, there was no way for the build_dir to be ever be None, and we can simplify code by fixing the unit test and enforcing that via updated type annotations. E.g. this lets us drop `get_file_path()` since it's now exactly equivalent to os.path.join(). Note: there's some `if build_dir` checks that also fail if build_dir is explicitly set to '' that just guard against passing "O=" to make. But running `make O=` works just fine, so drop these checks. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Since we formally require python3.7+ since commit df4b0807 ("kunit: tool: Assert the version requirement"), we can just use @dataclasses.dataclass instead. In kunit_config.py, we used namedtuple to create a hashable type that had `name` and `value` fields and had to subclass it to define a custom `__str__()`. @datalcass lets us just define one type instead. In qemu_config.py, we use namedtuple to allow modules to define various parameters. Using @dataclass, we can add type-annotations for all these fields, making our code more typesafe and making it easier for users to figure out how to define new configs. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-
Daniel Latypov authored
Commit be886ba9 ("kunit: run kunit_tool from any directory") introduced this variable, but it was unused even in that commit. Since it's still unused now and callers can instead use get_kernel_root_path(), delete this var. Signed-off-by:
Daniel Latypov <dlatypov@google.com> Reviewed-by:
David Gow <davidgow@google.com> Reviewed-by:
Brendan Higgins <brendanhiggins@google.com> Signed-off-by:
Shuah Khan <skhan@linuxfoundation.org>
-