summaryrefslogtreecommitdiff
path: root/lib/kunit/kunit-test.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-11-02 22:06:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-11-02 22:06:20 -0700
commit313b6ffc8e90173f1709b2f4bf9d30c4730a1dde (patch)
tree8a3488e109dcb7a06d2faeaa99be7a0d619ab5c1 /lib/kunit/kunit-test.c
parent84924e2e620f4395466d772767313fff0de1dad7 (diff)
parent52a5d80a2225e2d0b2a8f4656b76aead2a443b2a (diff)
Merge tag 'linux-kselftest-kunit-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull KUnit updates from Shuah Khan: "Several enhancements and fixes: - ability to run each test suite and test separately - support for timing test run - several fixes and improvements" * tag 'linux-kselftest-kunit-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: tool: fix typecheck errors about loading qemu configs kunit: tool: continue past invalid utf-8 output kunit: Reset suite count after running tests kunit: tool: improve compatibility of kunit_parser with KTAP specification kunit: tool: yield output from run_kernel in real time kunit: tool: support running each suite/test separately kunit: tool: actually track how long it took to run tests kunit: tool: factor exec + parse steps into a function kunit: add 'kunit.action' param to allow listing out tests kunit: tool: show list of valid --arch options when invalid kunit: tool: misc fixes (unused vars, imports, leaked files) kunit: fix too small allocation when using suite-only kunit.filter_glob kunit: tool: allow filtering test cases via glob kunit: drop assumption in kunit-log-test about current suite
Diffstat (limited to 'lib/kunit/kunit-test.c')
-rw-r--r--lib/kunit/kunit-test.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
index d69efcbed624..555601d17f79 100644
--- a/lib/kunit/kunit-test.c
+++ b/lib/kunit/kunit-test.c
@@ -415,12 +415,15 @@ static struct kunit_suite kunit_log_test_suite = {
static void kunit_log_test(struct kunit *test)
{
- struct kunit_suite *suite = &kunit_log_test_suite;
+ struct kunit_suite suite;
+
+ suite.log = kunit_kzalloc(test, KUNIT_LOG_SIZE, GFP_KERNEL);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, suite.log);
kunit_log(KERN_INFO, test, "put this in log.");
kunit_log(KERN_INFO, test, "this too.");
- kunit_log(KERN_INFO, suite, "add to suite log.");
- kunit_log(KERN_INFO, suite, "along with this.");
+ kunit_log(KERN_INFO, &suite, "add to suite log.");
+ kunit_log(KERN_INFO, &suite, "along with this.");
#ifdef CONFIG_KUNIT_DEBUGFS
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
@@ -428,12 +431,11 @@ static void kunit_log_test(struct kunit *test)
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
strstr(test->log, "this too."));
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
- strstr(suite->log, "add to suite log."));
+ strstr(suite.log, "add to suite log."));
KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
- strstr(suite->log, "along with this."));
+ strstr(suite.log, "along with this."));
#else
KUNIT_EXPECT_PTR_EQ(test, test->log, (char *)NULL);
- KUNIT_EXPECT_PTR_EQ(test, suite->log, (char *)NULL);
#endif
}