On Fri, Feb 11, 2022 at 8:33 AM Ricardo Ribalda ribalda@chromium.org wrote:
Hi Mika
On Fri, 11 Feb 2022 at 17:31, Mika Westerberg mika.westerberg@linux.intel.com wrote:
On Fri, Feb 11, 2022 at 06:26:56PM +0200, Mika Westerberg wrote:
To test it I had enabled: PCI, USB4 and USB4_KUNIT_TEST
and then run it with
./tools/testing/kunit/kunit.py run --jobs=$(nproc) --arch=x86_64
Unfortunately, kunit was not able to run the tests
This hack did the trick:
int tb_test_init(void) {
return __kunit_test_suites_init(tb_test_suites);
//return __kunit_test_suites_init(tb_test_suites);
return 0;
}
void tb_test_exit(void) {
return __kunit_test_suites_exit(tb_test_suites);
//return __kunit_test_suites_exit(tb_test_suites);
}
+kunit_test_suites(&tb_test_suite);
I looked into why we do this and I found:
thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m
I am a bit confused. The patch talks about build coverage, but even with that patch reverted if USB4_KUNIT_TEST=m then test.c is built.
Shouldn't we simply revert that patch?
Nah, either build it into the kernel or load the driver manually:
# modprobe thunderbolt
Forgot to explain why this does not run the tests (I think):
./tools/testing/kunit/kunit.py run --jobs=$(nproc) --arch=x86_64
The driver depends on PCI and I don't think that's enabled on UML at least. I typically run it inside QEMU.
You can get it working on UML now. If you apply the patch upthread for the test to use kunit_test_suites(), then
$ cat usb4_kunitconfig CONFIG_PCI=y CONFIG_VIRTIO_UML=y CONFIG_UML_PCI_OVER_VIRTIO=y
CONFIG_KUNIT=y CONFIG_USB4=y CONFIG_USB4_KUNIT_TEST=y
$ ./tools/testing/kunit/kunit.py run --kunitconfig=usb4_kunitconfig ... [14:48:55] [PASSED] tb_test_property_copy [14:48:55] =================== [PASSED] thunderbolt =================== [14:48:55] ============================================================ [14:48:55] Testing complete. Passed: 37, Failed: 0, Crashed: 0, Skipped: 0, Errors: 0
Mika, should I propose a patch that updates the test and adds a drivers/thunderbolt/.kunitconfig with the above contents?
Then it could be invoked as $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/thunderbolt