![]() 22:16 kunit: introduce KUnit, the Linux kernel unit testing framework Brendan Higgins Thread overview: 36+ messages / expand mbox.gz Atom feed top > Adds a warning message when comparing values of different types similar That can be fixed with some sort of compiler directive to make the error Importantly so that we don't trip over problems that caused those macros Kernel.h to do comparisons here so that we can get code reuse, but more Honestly, I'd prefer we just use the macros that we've developed in To allay concerns that we're duplicating logic for better error reusing the one that's there in kernel.h would be useful The commit text? The commit message is where you "sell" the patch, soīeing able to compare the tradeoff of having another macro to do typeĬomparisons vs. > I will squash it into the relevant commits on the next revision:Ĭan you provide the difference in error messages and describe that in > This is what we are thinking right now if you don't have any complaints > to understand, whereas _typecheck is obviously superior in terms of > and I thought the former created an error message that was a bit easier > macro? This might seem like a dumb question (and maybe it is), but Iurii > min/max used to work prior to 4.17, or to use the new _typecheck(.) > Do you think it would be better to do a phony compare similar to how > KUNIT_EXPECT_EQ_T() macro that lists the types to coerce both sides to > convert one type or the other they could do so with a > This would be similar to our min/max macros that complain about > both sides and cause a build warning/error if the types aren't the same. > Ok, I still wonder if we should make KUNIT_EXPECT_EQ check the types on > I did change the cast to make it more clear that it's a pointer to an > macro should do any type coercion that = operator wouldn't do. > dereference it as a pointer to an array of ints. > Data field is defined as void* so I believe casting is necessary to > second parameter based on the first type? > Is the casting necessary? Or can the macro do a type coercion of the > + KUNIT_EXPECT_EQ(test, -9, *(int *)table.data) ![]() > + KUNIT_EXPECT_EQ(test, sizeof(input) - 1, pos) > + KUNIT_EXPECT_EQ(test, sizeof(input) - 1, len) > + KUNIT_EXPECT_EQ(test, 0, proc_dointvec(&table, 1, input, &len, &pos)) > + table.data = kunit_kzalloc(test, sizeof(int), GFP_USER) > +static void sysctl_test_dointvec_happy_single_negative(struct kunit *test) > diff -git a/kernel/sysctl-test.c b/kernel/sysctl-test.c > On Fri, at 11:22 AM Stephen Boyd wrote: ![]() Re: kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec() - Stephen Boyd archive mirror help / color / mirror / Atom feed From: Stephen Boyd Ĭc: Iurii Zaikin Re: kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()ĭate: Tue, 11:50:17 -0700
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |